1KUBERNETES(1)                      Jan 2015                      KUBERNETES(1)
2
3
4

NAME

6       kubectl label - Update the labels on a resource
7
8
9

SYNOPSIS

11       kubectl label [OPTIONS]
12
13
14

DESCRIPTION

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

OPTIONS

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|go-template|go-tem‐
78       plate-file|template|templatefile|jsonpath|jsonpath-file.
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 [
113http://golang.org/pkg/text/template/#pkg-overview⟩].
114
115
116

OPTIONS INHERITED FROM PARENT COMMANDS

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="unix:///var/run/containerd.sock"
174           containerd endpoint
175
176
177       --context=""
178           The name of the kubeconfig context to use
179
180
181       --default-not-ready-toleration-seconds=300
182           Indicates   the   tolerationSeconds   of   the    toleration    for
183       notReady:NoExecute  that is added by default to every pod that does not
184       already have such a toleration.
185
186
187       --default-unreachable-toleration-seconds=300
188           Indicates the tolerationSeconds  of  the  toleration  for  unreach‐
189       able:NoExecute  that  is  added  by  default to every pod that does not
190       already have such a toleration.
191
192
193       --docker="unix:///var/run/docker.sock"
194           docker endpoint
195
196
197       --docker-env-metadata-whitelist=""
198           a comma-separated list of environment variable keys that  needs  to
199       be collected for docker containers
200
201
202       --docker-only=false
203           Only report docker containers in addition to root stats
204
205
206       --docker-root="/var/lib/docker"
207           DEPRECATED:  docker  root is read from docker info (this is a fall‐
208       back, default: /var/lib/docker)
209
210
211       --docker-tls=false
212           use TLS to connect to docker
213
214
215       --docker-tls-ca="ca.pem"
216           path to trusted CA
217
218
219       --docker-tls-cert="cert.pem"
220           path to client certificate
221
222
223       --docker-tls-key="key.pem"
224           path to private key
225
226
227       --enable-load-reader=false
228           Whether to enable cpu load reader
229
230
231       --event-storage-age-limit="default=0"
232           Max length of time for which to store events (per type). Value is a
233       comma  separated  list  of  key  values, where the keys are event types
234       (e.g.: creation, oom) or "default" and the value is a duration. Default
235       is applied to all non-specified event types
236
237
238       --event-storage-event-limit="default=0"
239           Max  number  of  events to store (per type). Value is a comma sepa‐
240       rated list of key values, where the keys are event  types  (e.g.:  cre‐
241       ation,  oom)  or  "default"  and  the  value  is an integer. Default is
242       applied to all non-specified event types
243
244
245       --global-housekeeping-interval=1m0s
246           Interval between global housekeepings
247
248
249       --housekeeping-interval=10s
250           Interval between container housekeepings
251
252
253       --insecure-skip-tls-verify=false
254           If true, the server's certificate will not be checked for validity.
255       This will make your HTTPS connections insecure
256
257
258       --kubeconfig=""
259           Path to the kubeconfig file to use for CLI requests.
260
261
262       --log-backtrace-at=:0
263           when logging hits line file:N, emit a stack trace
264
265
266       --log-cadvisor-usage=false
267           Whether to log the usage of the cAdvisor container
268
269
270       --log-dir=""
271           If non-empty, write log files in this directory
272
273
274       --log-file=""
275           If non-empty, use this log file
276
277
278       --log-flush-frequency=5s
279           Maximum number of seconds between log flushes
280
281
282       --logtostderr=true
283           log to standard error instead of files
284
285
286       --machine-id-file="/etc/machine-id,/var/lib/dbus/machine-id"
287           Comma-separated  list  of  files  to  check for machine-id. Use the
288       first one that exists.
289
290
291       --match-server-version=false
292           Require server version to match client version
293
294
295       --mesos-agent="127.0.0.1:5051"
296           Mesos agent address
297
298
299       --mesos-agent-timeout=10s
300           Mesos agent timeout
301
302
303       -n, --namespace=""
304           If present, the namespace scope for this CLI request
305
306
307       --password=""
308           Password for basic authentication to the API server
309
310
311       --profile="none"
312           Name of profile to capture. One of (none|cpu|heap|goroutine|thread‐
313       create|block|mutex)
314
315
316       --profile-output="profile.pprof"
317           Name of the file to write the profile to
318
319
320       --request-timeout="0"
321           The  length  of  time  to  wait before giving up on a single server
322       request. Non-zero values should contain a corresponding time unit (e.g.
323       1s, 2m, 3h). A value of zero means don't timeout requests.
324
325
326       -s, --server=""
327           The address and port of the Kubernetes API server
328
329
330       --skip-headers=false
331           If true, avoid header prefixes in the log messages
332
333
334       --stderrthreshold=2
335           logs at or above this threshold go to stderr
336
337
338       --storage-driver-buffer-duration=1m0s
339           Writes  in  the  storage driver will be buffered for this duration,
340       and committed to the non memory backends as a single transaction
341
342
343       --storage-driver-db="cadvisor"
344           database name
345
346
347       --storage-driver-host="localhost:8086"
348           database host:port
349
350
351       --storage-driver-password="root"
352           database password
353
354
355       --storage-driver-secure=false
356           use secure connection with database
357
358
359       --storage-driver-table="stats"
360           table name
361
362
363       --storage-driver-user="root"
364           database username
365
366
367       --token=""
368           Bearer token for authentication to the API server
369
370
371       --user=""
372           The name of the kubeconfig user to use
373
374
375       --username=""
376           Username for basic authentication to the API server
377
378
379       -v, --v=0
380           log level for V logs
381
382
383       --version=false
384           Print version information and quit
385
386
387       --vmodule=
388           comma-separated list of pattern=N settings for  file-filtered  log‐
389       ging
390
391
392

EXAMPLE

394                # Update pod 'foo' with the label 'unhealthy' and the value 'true'.
395                kubectl label pods foo unhealthy=true
396
397                # Update pod 'foo' with the label 'status' and the value 'unhealthy', overwriting any existing value.
398                kubectl label --overwrite pods foo status=unhealthy
399
400                # Update all pods in the namespace
401                kubectl label pods --all status=unhealthy
402
403                # Update a pod identified by the type and name in "pod.json"
404                kubectl label -f pod.json status=unhealthy
405
406                # Update pod 'foo' only if the resource is unchanged from version 1.
407                kubectl label pods foo status=unhealthy --resource-version=1
408
409                # Update pod 'foo' by removing a label named 'bar' if it exists.
410                # Does not require the --overwrite flag.
411                kubectl label pods foo bar-
412
413
414
415

SEE ALSO

417       kubectl(1),
418
419
420

HISTORY

422       January  2015,  Originally compiled by Eric Paris (eparis at redhat dot
423       com) based on the kubernetes source material, but hopefully  they  have
424       been automatically generated since!
425
426
427
428Eric Paris                  kubernetes User Manuals              KUBERNETES(1)
Impressum