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       --show-managed-fields=false       If  true, keep the managedFields when
111       printing objects in JSON or YAML format.
112
113
114       --template=""      Template string or path to template file to use when
115       -o=go-template, -o=go-template-file. The template format is golang tem‐
116       plates [http://golang.org/pkg/text/template/#pkg-overview].
117
118
119

OPTIONS INHERITED FROM PARENT COMMANDS

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

EXAMPLE

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

SEE ALSO

423       kubectl(1),
424
425
426

HISTORY

428       January 2015, Originally compiled by Eric Paris (eparis at  redhat  dot
429       com)  based  on the kubernetes source material, but hopefully they have
430       been automatically generated since!
431
432
433
434Manuals                              User            KUBERNETES(1)(kubernetes)
Impressum