1KUBERNETES(1) Jan 2015 KUBERNETES(1)
2
3
4
6 kubectl label - Update the labels on a resource
7
8
9
11 kubectl label [OPTIONS]
12
13
14
16 Update the labels on a resource.
17
18 0
19
20 item A label key and value must begin with a letter or number,
21 and may contain letters, numbers, hyphens, dots, and under‐
22 scores, up to 63 characters each.
23 item Optionally, the key can begin with a DNS subdomain prefix
24 and a single '/', like example.com/my-app
25 item If --overwrite is true, then existing labels can be over‐
26 written, otherwise attempting to overwrite a label will result
27 in an error.
28 item If --resource-version is specified, then updates will use
29 this resource version, otherwise the existing resource-version
30 will be used.
31
32
34 --all=false
35 Select all resources, including uninitialized ones, in the names‐
36 pace of the specified resource types
37
38
39 --allow-missing-template-keys=true
40 If true, ignore any errors in templates when a field or map key is
41 missing in the template. Only applies to golang and jsonpath output
42 formats.
43
44
45 --dry-run=false
46 If true, only print the object that would be sent, without sending
47 it.
48
49
50 --field-selector=""
51 Selector (field query) to filter on, supports '=', '==', and
52 '!='.(e.g. --field-selector key1=value1,key2=value2). The server only
53 supports a limited number of field queries per type.
54
55
56 -f, --filename=[]
57 Filename, directory, or URL to files identifying the resource to
58 update the labels
59
60
61 --include-uninitialized=false
62 If true, the kubectl command applies to uninitialized objects. If
63 explicitly set to false, this flag overrides other flags that make the
64 kubectl commands apply to uninitialized objects, e.g., "--all". Objects
65 with empty metadata.initializers are regarded as initialized.
66
67
68 --list=false
69 If true, display the labels for a given resource.
70
71
72 --local=false
73 If true, label will NOT contact api-server but run locally.
74
75
76 -o, --output=""
77 Output format. One of: json|yaml|name|template|go-template|go-tem‐
78 plate-file|templatefile|jsonpath-file|jsonpath.
79
80
81 --overwrite=false
82 If true, allow labels to be overwritten, otherwise reject label
83 updates that overwrite existing labels.
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 --resource-version=""
100 If non-empty, the labels update will only succeed if this is the
101 current resource-version for the object. Only valid when specifying a
102 single resource.
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 --allow-verification-with-non-compliant-keys=false
119 Allow a SignatureVerifier to use keys which are technically
120 non-compliant with RFC6962.
121
122
123 --alsologtostderr=false
124 log to standard error as well as files
125
126
127 --application-metrics-count-limit=100
128 Max number of application metrics to store (per container)
129
130
131 --as=""
132 Username to impersonate for the operation
133
134
135 --as-group=[]
136 Group to impersonate for the operation, this flag can be repeated
137 to specify multiple groups.
138
139
140 --azure-container-registry-config=""
141 Path to the file containing Azure container registry configuration
142 information.
143
144
145 --boot-id-file="/proc/sys/kernel/random/boot_id"
146 Comma-separated list of files to check for boot-id. Use the first
147 one that exists.
148
149
150 --cache-dir="/builddir/.kube/http-cache"
151 Default HTTP cache directory
152
153
154 --certificate-authority=""
155 Path to a cert file for the certificate authority
156
157
158 --client-certificate=""
159 Path to a client certificate file for TLS
160
161
162 --client-key=""
163 Path to a client key file for TLS
164
165
166 --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
167 CIDRs opened in GCE firewall for LB traffic proxy health checks
168
169
170 --cluster=""
171 The name of the kubeconfig cluster to use
172
173
174 --container-hints="/etc/cadvisor/container_hints.json"
175 location of the container hints file
176
177
178 --containerd="unix:///var/run/containerd.sock"
179 containerd endpoint
180
181
182 --context=""
183 The name of the kubeconfig context to use
184
185
186 --default-not-ready-toleration-seconds=300
187 Indicates the tolerationSeconds of the toleration for
188 notReady:NoExecute that is added by default to every pod that does not
189 already have such a toleration.
190
191
192 --default-unreachable-toleration-seconds=300
193 Indicates the tolerationSeconds of the toleration for unreach‐
194 able:NoExecute that is added by default to every pod that does not
195 already have such a toleration.
196
197
198 --docker="unix:///var/run/docker.sock"
199 docker endpoint
200
201
202 --docker-env-metadata-whitelist=""
203 a comma-separated list of environment variable keys that needs to
204 be collected for docker containers
205
206
207 --docker-only=false
208 Only report docker containers in addition to root stats
209
210
211 --docker-root="/var/lib/docker"
212 DEPRECATED: docker root is read from docker info (this is a fall‐
213 back, default: /var/lib/docker)
214
215
216 --docker-tls=false
217 use TLS to connect to docker
218
219
220 --docker-tls-ca="ca.pem"
221 path to trusted CA
222
223
224 --docker-tls-cert="cert.pem"
225 path to client certificate
226
227
228 --docker-tls-key="key.pem"
229 path to private key
230
231
232 --enable-load-reader=false
233 Whether to enable cpu load reader
234
235
236 --event-storage-age-limit="default=0"
237 Max length of time for which to store events (per type). Value is a
238 comma separated list of key values, where the keys are event types
239 (e.g.: creation, oom) or "default" and the value is a duration. Default
240 is applied to all non-specified event types
241
242
243 --event-storage-event-limit="default=0"
244 Max number of events to store (per type). Value is a comma sepa‐
245 rated list of key values, where the keys are event types (e.g.: cre‐
246 ation, oom) or "default" and the value is an integer. Default is
247 applied to all non-specified event types
248
249
250 --global-housekeeping-interval=1m0s
251 Interval between global housekeepings
252
253
254 --google-json-key=""
255 The Google Cloud Platform Service Account JSON Key to use for
256 authentication.
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-flush-frequency=5s
285 Maximum number of seconds between log flushes
286
287
288 --logtostderr=true
289 log to standard error instead of files
290
291
292 --machine-id-file="/etc/machine-id,/var/lib/dbus/machine-id"
293 Comma-separated list of files to check for machine-id. Use the
294 first one that exists.
295
296
297 --match-server-version=false
298 Require server version to match client version
299
300
301 --mesos-agent="127.0.0.1:5051"
302 Mesos agent address
303
304
305 --mesos-agent-timeout=10s
306 Mesos agent timeout
307
308
309 -n, --namespace=""
310 If present, the namespace scope for this CLI request
311
312
313 --request-timeout="0"
314 The length of time to wait before giving up on a single server
315 request. Non-zero values should contain a corresponding time unit (e.g.
316 1s, 2m, 3h). A value of zero means don't timeout requests.
317
318
319 -s, --server=""
320 The address and port of the Kubernetes API server
321
322
323 --stderrthreshold=2
324 logs at or above this threshold go to stderr
325
326
327 --storage-driver-buffer-duration=1m0s
328 Writes in the storage driver will be buffered for this duration,
329 and committed to the non memory backends as a single transaction
330
331
332 --storage-driver-db="cadvisor"
333 database name
334
335
336 --storage-driver-host="localhost:8086"
337 database host:port
338
339
340 --storage-driver-password="root"
341 database password
342
343
344 --storage-driver-secure=false
345 use secure connection with database
346
347
348 --storage-driver-table="stats"
349 table name
350
351
352 --storage-driver-user="root"
353 database username
354
355
356 --token=""
357 Bearer token for authentication to the API server
358
359
360 --user=""
361 The name of the kubeconfig user to use
362
363
364 -v, --v=0
365 log level for V logs
366
367
368 --version=false
369 Print version information and quit
370
371
372 --vmodule=
373 comma-separated list of pattern=N settings for file-filtered log‐
374 ging
375
376
377
379 # Update pod 'foo' with the label 'unhealthy' and the value 'true'.
380 kubectl label pods foo unhealthy=true
381
382 # Update pod 'foo' with the label 'status' and the value 'unhealthy', overwriting any existing value.
383 kubectl label --overwrite pods foo status=unhealthy
384
385 # Update all pods in the namespace
386 kubectl label pods --all status=unhealthy
387
388 # Update a pod identified by the type and name in "pod.json"
389 kubectl label -f pod.json status=unhealthy
390
391 # Update pod 'foo' only if the resource is unchanged from version 1.
392 kubectl label pods foo status=unhealthy --resource-version=1
393
394 # Update pod 'foo' by removing a label named 'bar' if it exists.
395 # Does not require the --overwrite flag.
396 kubectl label pods foo bar-
397
398
399
400
402 kubectl(1),
403
404
405
407 January 2015, Originally compiled by Eric Paris (eparis at redhat dot
408 com) based on the kubernetes source material, but hopefully they have
409 been automatically generated since!
410
411
412
413Eric Paris kubernetes User Manuals KUBERNETES(1)