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

NAME

6       kubectl annotate - Update the annotations on a resource
7
8
9

SYNOPSIS

11       kubectl annotate [OPTIONS]
12
13
14

DESCRIPTION

16       Update the annotations on one or more resources
17
18
19       All  Kubernetes  objects  support  the ability to store additional data
20       with the object as annotations. Annotations are  key/value  pairs  that
21       can  be  larger than labels and include arbitrary string values such as
22       structured JSON. Tools and system extensions  may  use  annotations  to
23       store their own data.
24
25
26       Attempting  to  set  an annotation that already exists will fail unless
27       --overwrite is set. If --resource-version is  specified  and  does  not
28       match the current resource version on the server the command will fail.
29
30
31       Use "kubectl api-resources" for a complete list of supported resources.
32
33
34

OPTIONS

36       --all=false
37           Select  all  resources, including uninitialized ones, in the names‐
38       pace of the specified resource types.
39
40
41       --allow-missing-template-keys=true
42           If true, ignore any errors in templates when a field or map key  is
43       missing  in  the  template.  Only applies to golang and jsonpath output
44       formats.
45
46
47       --dry-run=false
48           If true, only print the object that would be sent, without  sending
49       it.
50
51
52       --field-selector=""
53           Selector  (field  query)  to  filter  on,  supports  '=', '==', and
54       '!='.(e.g. --field-selector key1=value1,key2=value2). The  server  only
55       supports a limited number of field queries per type.
56
57
58       -f, --filename=[]
59           Filename,  directory,  or  URL to files identifying the resource to
60       update the annotation
61
62
63       --include-uninitialized=false
64           If true, the kubectl command applies to uninitialized  objects.  If
65       explicitly  set to false, this flag overrides other flags that make the
66       kubectl commands apply to uninitialized objects, e.g., "--all". Objects
67       with empty metadata.initializers are regarded as initialized.
68
69
70       -k, --kustomize=""
71           Process  the  kustomization  directory.  This  flag  can't  be used
72       together with -f or -R.
73
74
75       --local=false
76           If true, annotation will NOT contact api-server but run locally.
77
78
79       -o, --output=""
80           Output   format.   One    of:    json|yaml|name|go-template|go-tem‐
81       plate-file|template|templatefile|jsonpath|jsonpath-file.
82
83
84       --overwrite=false
85           If  true,  allow  annotations  to  be overwritten, otherwise reject
86       annotation updates that overwrite existing annotations.
87
88
89       --record=false
90           Record current kubectl command in the resource annotation.  If  set
91       to  false,  do  not record the command. If set to true, record the com‐
92       mand. If not set, default to updating  the  existing  annotation  value
93       only if one already exists.
94
95
96       -R, --recursive=false
97           Process  the  directory  used in -f, --filename recursively. Useful
98       when you want to manage related manifests  organized  within  the  same
99       directory.
100
101
102       --resource-version=""
103           If  non-empty,  the  annotation update will only succeed if this is
104       the current resource-version for the object. Only valid when specifying
105       a single resource.
106
107
108       -l, --selector=""
109           Selector  (label  query)  to filter on, not including uninitialized
110       ones, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2).
111
112
113       --template=""
114           Template string or path to template file  to  use  when  -o=go-tem‐
115       plate,  -o=go-template-file.  The template format is golang templates [
116http://golang.org/pkg/text/template/#pkg-overview⟩].
117
118
119

OPTIONS INHERITED FROM PARENT COMMANDS

121       --alsologtostderr=false
122           log to standard error as well as files
123
124
125       --application-metrics-count-limit=100
126           Max number of application metrics to store (per container)
127
128
129       --as=""
130           Username to impersonate for the operation
131
132
133       --as-group=[]
134           Group to impersonate for the operation, this flag can  be  repeated
135       to specify multiple groups.
136
137
138       --azure-container-registry-config=""
139           Path  to the file containing Azure container registry configuration
140       information.
141
142
143       --boot-id-file="/proc/sys/kernel/random/boot_id"
144           Comma-separated list of files to check for boot-id. Use  the  first
145       one that exists.
146
147
148       --cache-dir="/builddir/.kube/http-cache"
149           Default HTTP cache directory
150
151
152       --certificate-authority=""
153           Path to a cert file for the certificate authority
154
155
156       --client-certificate=""
157           Path to a client certificate file for TLS
158
159
160       --client-key=""
161           Path to a client key file for TLS
162
163
164       --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
165           CIDRs opened in GCE firewall for LB traffic proxy  health checks
166
167
168       --cluster=""
169           The name of the kubeconfig cluster to use
170
171
172       --container-hints="/etc/cadvisor/container_hints.json"
173           location of the container hints file
174
175
176       --containerd="/run/containerd/containerd.sock"
177           containerd endpoint
178
179
180       --containerd-namespace="k8s.io"
181           containerd namespace
182
183
184       --context=""
185           The name of the kubeconfig context to use
186
187
188       --default-not-ready-toleration-seconds=300
189           Indicates   the   tolerationSeconds   of   the    toleration    for
190       notReady:NoExecute  that is added by default to every pod that does not
191       already have such a toleration.
192
193
194       --default-unreachable-toleration-seconds=300
195           Indicates the tolerationSeconds  of  the  toleration  for  unreach‐
196       able:NoExecute  that  is  added  by  default to every pod that does not
197       already have such a toleration.
198
199
200       --docker="unix:///var/run/docker.sock"
201           docker endpoint
202
203
204       --docker-env-metadata-whitelist=""
205           a comma-separated list of environment variable keys that  needs  to
206       be collected for docker containers
207
208
209       --docker-only=false
210           Only report docker containers in addition to root stats
211
212
213       --docker-root="/var/lib/docker"
214           DEPRECATED:  docker  root is read from docker info (this is a fall‐
215       back, default: /var/lib/docker)
216
217
218       --docker-tls=false
219           use TLS to connect to docker
220
221
222       --docker-tls-ca="ca.pem"
223           path to trusted CA
224
225
226       --docker-tls-cert="cert.pem"
227           path to client certificate
228
229
230       --docker-tls-key="key.pem"
231           path to private key
232
233
234       --enable-load-reader=false
235           Whether to enable cpu load reader
236
237
238       --event-storage-age-limit="default=0"
239           Max length of time for which to store events (per type). Value is a
240       comma  separated  list  of  key  values, where the keys are event types
241       (e.g.: creation, oom) or "default" and the value is a duration. Default
242       is applied to all non-specified event types
243
244
245       --event-storage-event-limit="default=0"
246           Max  number  of  events to store (per type). Value is a comma sepa‐
247       rated list of key values, where the keys are event  types  (e.g.:  cre‐
248       ation,  oom)  or  "default"  and  the  value  is an integer. Default is
249       applied to all non-specified event types
250
251
252       --global-housekeeping-interval=1m0s
253           Interval between global housekeepings
254
255
256       --housekeeping-interval=10s
257           Interval between container housekeepings
258
259
260       --insecure-skip-tls-verify=false
261           If true, the server's certificate will not be checked for validity.
262       This will make your HTTPS connections insecure
263
264
265       --kubeconfig=""
266           Path to the kubeconfig file to use for CLI requests.
267
268
269       --log-backtrace-at=:0
270           when logging hits line file:N, emit a stack trace
271
272
273       --log-cadvisor-usage=false
274           Whether to log the usage of the cAdvisor container
275
276
277       --log-dir=""
278           If non-empty, write log files in this directory
279
280
281       --log-file=""
282           If non-empty, use this log file
283
284
285       --log-file-max-size=1800
286           Defines the maximum size a log file can grow to. Unit is megabytes.
287       If the value is 0, the maximum file size is unlimited.
288
289
290       --log-flush-frequency=5s
291           Maximum number of seconds between log flushes
292
293
294       --logtostderr=true
295           log to standard error instead of files
296
297
298       --machine-id-file="/etc/machine-id,/var/lib/dbus/machine-id"
299           Comma-separated list of files to  check  for  machine-id.  Use  the
300       first one that exists.
301
302
303       --match-server-version=false
304           Require server version to match client version
305
306
307       -n, --namespace=""
308           If present, the namespace scope for this CLI request
309
310
311       --password=""
312           Password for basic authentication to the API server
313
314
315       --profile="none"
316           Name of profile to capture. One of (none|cpu|heap|goroutine|thread‐
317       create|block|mutex)
318
319
320       --profile-output="profile.pprof"
321           Name of the file to write the profile to
322
323
324       --request-timeout="0"
325           The length of time to wait before giving  up  on  a  single  server
326       request. Non-zero values should contain a corresponding time unit (e.g.
327       1s, 2m, 3h). A value of zero means don't timeout requests.
328
329
330       -s, --server=""
331           The address and port of the Kubernetes API server
332
333
334       --skip-headers=false
335           If true, avoid header prefixes in the log messages
336
337
338       --skip-log-headers=false
339           If true, avoid headers when opening log files
340
341
342       --stderrthreshold=2
343           logs at or above this threshold go to stderr
344
345
346       --storage-driver-buffer-duration=1m0s
347           Writes in the storage driver will be buffered  for  this  duration,
348       and committed to the non memory backends as a single transaction
349
350
351       --storage-driver-db="cadvisor"
352           database name
353
354
355       --storage-driver-host="localhost:8086"
356           database host:port
357
358
359       --storage-driver-password="root"
360           database password
361
362
363       --storage-driver-secure=false
364           use secure connection with database
365
366
367       --storage-driver-table="stats"
368           table name
369
370
371       --storage-driver-user="root"
372           database username
373
374
375       --token=""
376           Bearer token for authentication to the API server
377
378
379       --update-machine-info-interval=5m0s
380           Interval between machine info updates.
381
382
383       --user=""
384           The name of the kubeconfig user to use
385
386
387       --username=""
388           Username for basic authentication to the API server
389
390
391       -v, --v=0
392           number for the log level verbosity
393
394
395       --version=false
396           Print version information and quit
397
398
399       --vmodule=
400           comma-separated  list  of pattern=N settings for file-filtered log‐
401       ging
402
403
404

EXAMPLE

406                # Update pod 'foo' with the annotation 'description' and the value 'my frontend'.
407                # If the same annotation is set multiple times, only the last value will be applied
408                kubectl annotate pods foo description='my frontend'
409
410                # Update a pod identified by type and name in "pod.json"
411                kubectl annotate -f pod.json description='my frontend'
412
413                # Update pod 'foo' with the annotation 'description' and the value 'my frontend running nginx', overwriting any existing value.
414                kubectl annotate --overwrite pods foo description='my frontend running nginx'
415
416                # Update all pods in the namespace
417                kubectl annotate pods --all description='my frontend running nginx'
418
419                # Update pod 'foo' only if the resource is unchanged from version 1.
420                kubectl annotate pods foo description='my frontend running nginx' --resource-version=1
421
422                # Update pod 'foo' by removing an annotation named 'description' if it exists.
423                # Does not require the --overwrite flag.
424                kubectl annotate pods foo description-
425
426
427
428

SEE ALSO

430       kubectl(1),
431
432
433

HISTORY

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)
Impressum