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