1KUBERNETES(1)(kubernetes) KUBERNETES(1)(kubernetes)
2
3
4
5Eric Paris Jan 2015
6
7
9 kubectl set resources - Update resource requests/limits on objects with
10 pod templates
11
12
13
15 kubectl set resources [OPTIONS]
16
17
18
20 Specify compute resource requirements (CPU, memory) for any resource
21 that defines a pod template. If a pod is successfully scheduled, it is
22 guaranteed the amount of resource requested, but may burst up to its
23 specified limits.
24
25
26 For each compute resource, if a limit is specified and a request is
27 omitted, the request will default to the limit.
28
29
30 Possible resources include (case insensitive): Use "kubectl api-re‐
31 sources" for a complete list of supported resources..
32
33
34
36 --all=false Select all resources, in the namespace of the speci‐
37 fied resource types
38
39
40 --allow-missing-template-keys=true If true, ignore any errors in
41 templates when a field or map key is missing in the template. Only ap‐
42 plies to golang and jsonpath output formats.
43
44
45 -c, --containers="*" The names of containers in the selected pod
46 templates to change, all containers are selected by default - may use
47 wildcards
48
49
50 --dry-run="none" Must be "none", "server", or "client". If client
51 strategy, only print the object that would be sent, without sending it.
52 If server strategy, submit server-side request without persisting the
53 resource.
54
55
56 --field-manager="kubectl-set" Name of the manager used to track
57 field ownership.
58
59
60 -f, --filename=[] Filename, directory, or URL to files identifying
61 the resource to get from a server.
62
63
64 -k, --kustomize="" Process the kustomization directory. This flag
65 can't be used together with -f or -R.
66
67
68 --limits="" The resource requirement requests for this container.
69 For example, 'cpu=100m,memory=256Mi'. Note that server side components
70 may assign requests depending on the server configuration, such as
71 limit ranges.
72
73
74 --local=false If true, set resources will NOT contact api-server
75 but run locally.
76
77
78 -o, --output="" Output format. One of: (json, yaml, name, go-tem‐
79 plate, go-template-file, template, templatefile, jsonpath, jsonpath-as-
80 json, jsonpath-file).
81
82
83 --record=false Record current kubectl command in the resource an‐
84 notation. If set to false, do not record the command. If set to true,
85 record the command. If not set, default to updating the existing anno‐
86 tation value only if one already exists.
87
88
89 -R, --recursive=false Process the directory used in -f, --filename
90 recursively. Useful when you want to manage related manifests organized
91 within the same directory.
92
93
94 --requests="" The resource requirement requests for this con‐
95 tainer. For example, 'cpu=100m,memory=256Mi'. Note that server side
96 components may assign requests depending on the server configuration,
97 such as limit ranges.
98
99
100 -l, --selector="" Selector (label query) to filter on, supports
101 '=', '==', and '!='.(e.g. -l key1=value1,key2=value2). Matching objects
102 must satisfy all of the specified label constraints.
103
104
105 --show-managed-fields=false If true, keep the managedFields when
106 printing objects in JSON or YAML format.
107
108
109 --template="" Template string or path to template file to use when
110 -o=go-template, -o=go-template-file. The template format is golang tem‐
111 plates [http://golang.org/pkg/text/template/#pkg-overview].
112
113
114
116 --as="" Username to impersonate for the operation. User could be a
117 regular user or a service account in a namespace.
118
119
120 --as-group=[] Group to impersonate for the operation, this flag
121 can be repeated to specify multiple groups.
122
123
124 --as-uid="" UID to impersonate for the operation.
125
126
127 --azure-container-registry-config="" Path to the file containing
128 Azure container registry configuration information.
129
130
131 --cache-dir="/builddir/.kube/cache" Default cache directory
132
133
134 --certificate-authority="" Path to a cert file for the certificate
135 authority
136
137
138 --client-certificate="" Path to a client certificate file for TLS
139
140
141 --client-key="" Path to a client key file for TLS
142
143
144 --cluster="" The name of the kubeconfig cluster to use
145
146
147 --context="" The name of the kubeconfig context to use
148
149
150 --disable-compression=false If true, opt-out of response compres‐
151 sion for all requests to the server
152
153
154 --insecure-skip-tls-verify=false If true, the server's certificate
155 will not be checked for validity. This will make your HTTPS connections
156 insecure
157
158
159 --kubeconfig="" Path to the kubeconfig file to use for CLI re‐
160 quests.
161
162
163 --match-server-version=false Require server version to match
164 client version
165
166
167 -n, --namespace="" If present, the namespace scope for this CLI
168 request
169
170
171 --password="" Password for basic authentication to the API server
172
173
174 --profile="none" Name of profile to capture. One of
175 (none|cpu|heap|goroutine|threadcreate|block|mutex)
176
177
178 --profile-output="profile.pprof" Name of the file to write the
179 profile to
180
181
182 --request-timeout="0" The length of time to wait before giving up
183 on a single server request. Non-zero values should contain a corre‐
184 sponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't time‐
185 out requests.
186
187
188 -s, --server="" The address and port of the Kubernetes API server
189
190
191 --tls-server-name="" Server name to use for server certificate
192 validation. If it is not provided, the hostname used to contact the
193 server is used
194
195
196 --token="" Bearer token for authentication to the API server
197
198
199 --user="" The name of the kubeconfig user to use
200
201
202 --username="" Username for basic authentication to the API server
203
204
205 --version=false Print version information and quit
206
207
208 --warnings-as-errors=false Treat warnings received from the server
209 as errors and exit with a non-zero exit code
210
211
212
214 # Set a deployments nginx container cpu limits to "200m" and memory to "512Mi"
215 kubectl set resources deployment nginx -c=nginx --limits=cpu=200m,memory=512Mi
216
217 # Set the resource request and limits for all containers in nginx
218 kubectl set resources deployment nginx --limits=cpu=200m,memory=512Mi --requests=cpu=100m,memory=256Mi
219
220 # Remove the resource requests for resources on containers in nginx
221 kubectl set resources deployment nginx --limits=cpu=0,memory=0 --requests=cpu=0,memory=0
222
223 # Print the result (in yaml format) of updating nginx container limits from a local, without hitting the server
224 kubectl set resources -f path/to/file.yaml --limits=cpu=200m,memory=512Mi --local -o yaml
225
226
227
228
230 kubectl-set(1),
231
232
233
235 January 2015, Originally compiled by Eric Paris (eparis at redhat dot
236 com) based on the kubernetes source material, but hopefully they have
237 been automatically generated since!
238
239
240
241Manuals User KUBERNETES(1)(kubernetes)