1KUBERNETES(1)(kubernetes)                            KUBERNETES(1)(kubernetes)
2
3
4
5Eric Paris Jan 2015
6
7

NAME

9       kubectl annotate - Update the annotations on a resource
10
11
12

SYNOPSIS

14       kubectl annotate [OPTIONS]
15
16
17

DESCRIPTION

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

OPTIONS

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

OPTIONS INHERITED FROM PARENT COMMANDS

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

EXAMPLE

395                # Update pod 'foo' with the annotation 'description' and the value 'my frontend'.
396                # If the same annotation is set multiple times, only the last value will be applied
397                kubectl annotate pods foo description='my frontend'
398
399                # Update a pod identified by type and name in "pod.json"
400                kubectl annotate -f pod.json description='my frontend'
401
402                # Update pod 'foo' with the annotation 'description' and the value 'my frontend running nginx', overwriting any existing value.
403                kubectl annotate --overwrite pods foo description='my frontend running nginx'
404
405                # Update all pods in the namespace
406                kubectl annotate pods --all description='my frontend running nginx'
407
408                # Update pod 'foo' only if the resource is unchanged from version 1.
409                kubectl annotate pods foo description='my frontend running nginx' --resource-version=1
410
411                # Update pod 'foo' by removing an annotation named 'description' if it exists.
412                # Does not require the --overwrite flag.
413                kubectl annotate pods foo description-
414
415
416
417

SEE ALSO

419       kubectl(1),
420
421
422

HISTORY

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
430Manuals                              User            KUBERNETES(1)(kubernetes)
Impressum