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       --local=false
71           If true, annotation will NOT contact api-server but run locally.
72
73
74       -o, --output=""
75           Output    format.    One   of:   json|yaml|name|go-template|go-tem‐
76       plate-file|template|templatefile|jsonpath|jsonpath-file.
77
78
79       --overwrite=false
80           If true, allow annotations  to  be  overwritten,  otherwise  reject
81       annotation updates that overwrite existing annotations.
82
83
84       --record=false
85           Record  current  kubectl command in the resource annotation. If set
86       to false, do not record the command. If set to true,  record  the  com‐
87       mand.  If  not  set,  default to updating the existing annotation value
88       only if one already exists.
89
90
91       -R, --recursive=false
92           Process the directory used in -f,  --filename  recursively.  Useful
93       when  you  want  to  manage related manifests organized within the same
94       directory.
95
96
97       --resource-version=""
98           If non-empty, the annotation update will only succeed  if  this  is
99       the current resource-version for the object. Only valid when specifying
100       a single resource.
101
102
103       -l, --selector=""
104           Selector (label query) to filter on,  not  including  uninitialized
105       ones, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2).
106
107
108       --template=""
109           Template  string  or  path  to template file to use when -o=go-tem‐
110       plate, -o=go-template-file. The template format is golang  templates  [
111http://golang.org/pkg/text/template/#pkg-overview⟩].
112
113
114

OPTIONS INHERITED FROM PARENT COMMANDS

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

EXAMPLE

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

SEE ALSO

416       kubectl(1),
417
418
419

HISTORY

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