1KUBERNETES(1) Jan 2015 KUBERNETES(1)
2
3
4
6 kubectl set resources - Update resource requests/limits on objects with
7 pod templates
8
9
10
12 kubectl set resources [OPTIONS]
13
14
15
17 Specify compute resource requirements (cpu, memory) for any resource
18 that defines a pod template. If a pod is successfully scheduled, it is
19 guaranteed the amount of resource requested, but may burst up to its
20 specified limits.
21
22
23 for each compute resource, if a limit is specified and a request is
24 omitted, the request will default to the limit.
25
26
27 Possible resources include (case insensitive): Use "kubectl
28 api-resources" for a complete list of supported resources..
29
30
31
33 --all=false
34 Select all resources, including uninitialized ones, in the
35 namespace of the specified resource types
36
37
38 --allow-missing-template-keys=true
39 If true, ignore any errors in templates when a field or map key is
40 missing in the template. Only applies to golang and jsonpath output
41 formats.
42
43
44 -c, --containers="*"
45 The names of containers in the selected pod templates to change,
46 all containers are selected by default - may use wildcards
47
48
49 --dry-run="none"
50 Must be "none", "server", or "client". If client strategy, only
51 print the object that would be sent, without sending it. If server
52 strategy, submit server-side request without persisting the resource.
53
54
55 -f, --filename=[]
56 Filename, directory, or URL to files identifying the resource to
57 get from a server.
58
59
60 -k, --kustomize=""
61 Process the kustomization directory. This flag can't be used
62 together with -f or -R.
63
64
65 --limits=""
66 The resource requirement requests for this container. For example,
67 'cpu=100m,memory=256Mi'. Note that server side components may assign
68 requests depending on the server configuration, such as limit ranges.
69
70
71 --local=false
72 If true, set resources will NOT contact api-server but run locally.
73
74
75 -o, --output=""
76 Output format. One of:
77 json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.
78
79
80 --record=false
81 Record current kubectl command in the resource annotation. If set
82 to false, do not record the command. If set to true, record the
83 command. If not set, default to updating the existing annotation value
84 only if one already exists.
85
86
87 -R, --recursive=false
88 Process the directory used in -f, --filename recursively. Useful
89 when you want to manage related manifests organized within the same
90 directory.
91
92
93 --requests=""
94 The resource requirement requests for this container. For example,
95 'cpu=100m,memory=256Mi'. Note that server side components may assign
96 requests depending on the server configuration, such as limit ranges.
97
98
99 -l, --selector=""
100 Selector (label query) to filter on, not including uninitialized
101 ones,supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)
102
103
104 --template=""
105 Template string or path to template file to use when
106 -o=go-template, -o=go-template-file. The template format is golang
107 templates [ ⟨http://golang.org/pkg/text/template/#pkg-overview⟩].
108
109
110
112 --add-dir-header=false
113 If true, adds the file directory to the header
114
115
116 --alsologtostderr=false
117 log to standard error as well as files
118
119
120 --application-metrics-count-limit=100
121 Max number of application metrics to store (per container)
122
123
124 --as=""
125 Username to impersonate for the operation
126
127
128 --as-group=[]
129 Group to impersonate for the operation, this flag can be repeated
130 to specify multiple groups.
131
132
133 --azure-container-registry-config=""
134 Path to the file containing Azure container registry configuration
135 information.
136
137
138 --boot-id-file="/proc/sys/kernel/random/boot_id"
139 Comma-separated list of files to check for boot-id. Use the first
140 one that exists.
141
142
143 --cache-dir="/builddir/.kube/http-cache"
144 Default HTTP cache directory
145
146
147 --certificate-authority=""
148 Path to a cert file for the certificate authority
149
150
151 --client-certificate=""
152 Path to a client certificate file for TLS
153
154
155 --client-key=""
156 Path to a client key file for TLS
157
158
159 --cloud-provider-gce-l7lb-src-cidrs=130.211.0.0/22,35.191.0.0/16
160 CIDRs opened in GCE firewall for L7 LB traffic proxy health checks
161
162
163 --cloud-provider-gce-lb-src-cidrs=130.211.0.0/22,209.85.152.0/22,209.85.204.0/22,35.191.0.0/16
164 CIDRs opened in GCE firewall for L4 LB traffic proxy health checks
165
166
167 --cluster=""
168 The name of the kubeconfig cluster to use
169
170
171 --container-hints="/etc/cadvisor/container_hints.json"
172 location of the container hints file
173
174
175 --containerd="/run/containerd/containerd.sock"
176 containerd endpoint
177
178
179 --containerd-namespace="k8s.io"
180 containerd namespace
181
182
183 --context=""
184 The name of the kubeconfig context to use
185
186
187 --default-not-ready-toleration-seconds=300
188 Indicates the tolerationSeconds of the toleration for
189 notReady:NoExecute that is added by default to every pod that does not
190 already have such a toleration.
191
192
193 --default-unreachable-toleration-seconds=300
194 Indicates the tolerationSeconds of the toleration for
195 unreachable:NoExecute that is added by default to every pod that does
196 not already have such a toleration.
197
198
199 --disable-root-cgroup-stats=false
200 Disable collecting root Cgroup stats
201
202
203 --docker="unix:///var/run/docker.sock"
204 docker endpoint
205
206
207 --docker-env-metadata-whitelist=""
208 a comma-separated list of environment variable keys that needs to
209 be collected for docker containers
210
211
212 --docker-only=false
213 Only report docker containers in addition to root stats
214
215
216 --docker-root="/var/lib/docker"
217 DEPRECATED: docker root is read from docker info (this is a
218 fallback, default: /var/lib/docker)
219
220
221 --docker-tls=false
222 use TLS to connect to docker
223
224
225 --docker-tls-ca="ca.pem"
226 path to trusted CA
227
228
229 --docker-tls-cert="cert.pem"
230 path to client certificate
231
232
233 --docker-tls-key="key.pem"
234 path to private key
235
236
237 --enable-load-reader=false
238 Whether to enable cpu load reader
239
240
241 --event-storage-age-limit="default=0"
242 Max length of time for which to store events (per type). Value is a
243 comma separated list of key values, where the keys are event types
244 (e.g.: creation, oom) or "default" and the value is a duration. Default
245 is applied to all non-specified event types
246
247
248 --event-storage-event-limit="default=0"
249 Max number of events to store (per type). Value is a comma
250 separated list of key values, where the keys are event types (e.g.:
251 creation, oom) or "default" and the value is an integer. Default is
252 applied to all non-specified event types
253
254
255 --global-housekeeping-interval=1m0s
256 Interval between global housekeepings
257
258
259 --housekeeping-interval=10s
260 Interval between container housekeepings
261
262
263 --insecure-skip-tls-verify=false
264 If true, the server's certificate will not be checked for validity.
265 This will make your HTTPS connections insecure
266
267
268 --kubeconfig=""
269 Path to the kubeconfig file to use for CLI requests.
270
271
272 --log-backtrace-at=:0
273 when logging hits line file:N, emit a stack trace
274
275
276 --log-cadvisor-usage=false
277 Whether to log the usage of the cAdvisor container
278
279
280 --log-dir=""
281 If non-empty, write log files in this directory
282
283
284 --log-file=""
285 If non-empty, use this log file
286
287
288 --log-file-max-size=1800
289 Defines the maximum size a log file can grow to. Unit is megabytes.
290 If the value is 0, the maximum file size is unlimited.
291
292
293 --log-flush-frequency=5s
294 Maximum number of seconds between log flushes
295
296
297 --logtostderr=true
298 log to standard error instead of files
299
300
301 --machine-id-file="/etc/machine-id,/var/lib/dbus/machine-id"
302 Comma-separated list of files to check for machine-id. Use the
303 first one that exists.
304
305
306 --match-server-version=false
307 Require server version to match client version
308
309
310 -n, --namespace=""
311 If present, the namespace scope for this CLI request
312
313
314 --password=""
315 Password for basic authentication to the API server
316
317
318 --profile="none"
319 Name of profile to capture. One of
320 (none|cpu|heap|goroutine|threadcreate|block|mutex)
321
322
323 --profile-output="profile.pprof"
324 Name of the file to write the profile to
325
326
327 --request-timeout="0"
328 The length of time to wait before giving up on a single server
329 request. Non-zero values should contain a corresponding time unit (e.g.
330 1s, 2m, 3h). A value of zero means don't timeout requests.
331
332
333 -s, --server=""
334 The address and port of the Kubernetes API server
335
336
337 --skip-headers=false
338 If true, avoid header prefixes in the log messages
339
340
341 --skip-log-headers=false
342 If true, avoid headers when opening log files
343
344
345 --stderrthreshold=2
346 logs at or above this threshold go to stderr
347
348
349 --storage-driver-buffer-duration=1m0s
350 Writes in the storage driver will be buffered for this duration,
351 and committed to the non memory backends as a single transaction
352
353
354 --storage-driver-db="cadvisor"
355 database name
356
357
358 --storage-driver-host="localhost:8086"
359 database host:port
360
361
362 --storage-driver-password="root"
363 database password
364
365
366 --storage-driver-secure=false
367 use secure connection with database
368
369
370 --storage-driver-table="stats"
371 table name
372
373
374 --storage-driver-user="root"
375 database username
376
377
378 --tls-server-name=""
379 Server name to use for server certificate validation. If it is not
380 provided, the hostname used to contact the server is used
381
382
383 --token=""
384 Bearer token for authentication to the API server
385
386
387 --update-machine-info-interval=5m0s
388 Interval between machine info updates.
389
390
391 --user=""
392 The name of the kubeconfig user to use
393
394
395 --username=""
396 Username for basic authentication to the API server
397
398
399 -v, --v=0
400 number for the log level verbosity
401
402
403 --version=false
404 Print version information and quit
405
406
407 --vmodule=
408 comma-separated list of pattern=N settings for file-filtered
409 logging
410
411
412
414 # Set a deployments nginx container cpu limits to "200m" and memory to "512Mi"
415 kubectl set resources deployment nginx -c=nginx --limits=cpu=200m,memory=512Mi
416
417 # Set the resource request and limits for all containers in nginx
418 kubectl set resources deployment nginx --limits=cpu=200m,memory=512Mi --requests=cpu=100m,memory=256Mi
419
420 # Remove the resource requests for resources on containers in nginx
421 kubectl set resources deployment nginx --limits=cpu=0,memory=0 --requests=cpu=0,memory=0
422
423 # Print the result (in yaml format) of updating nginx container limits from a local, without hitting the server
424 kubectl set resources -f path/to/file.yaml --limits=cpu=200m,memory=512Mi --local -o yaml
425
426
427
428
430 kubectl-set(1),
431
432
433
435 January 2015, Originally compiled by Eric Paris (eparis at redhat dot
436 com) based on the kubernetes source material, but hopefully they have
437 been automatically generated since!
438
439
440
441Eric Paris kubernetes User Manuals KUBERNETES(1)