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

EXAMPLE

377                # Update pod 'foo' with the annotation 'description' and the value 'my frontend'.
378                # If the same annotation is set multiple times, only the last value will be applied
379                kubectl annotate pods foo description='my frontend'
380
381                # Update a pod identified by type and name in "pod.json"
382                kubectl annotate -f pod.json description='my frontend'
383
384                # Update pod 'foo' with the annotation 'description' and the value 'my frontend running nginx', overwriting any existing value.
385                kubectl annotate --overwrite pods foo description='my frontend running nginx'
386
387                # Update all pods in the namespace
388                kubectl annotate pods --all description='my frontend running nginx'
389
390                # Update pod 'foo' only if the resource is unchanged from version 1.
391                kubectl annotate pods foo description='my frontend running nginx' --resource-version=1
392
393                # Update pod 'foo' by removing an annotation named 'description' if it exists.
394                # Does not require the --overwrite flag.
395                kubectl annotate pods foo description-
396
397
398
399

SEE ALSO

401       kubectl(1),
402
403
404

HISTORY

406       January  2015,  Originally compiled by Eric Paris (eparis at redhat dot
407       com) based on the kubernetes source material, but hopefully  they  have
408       been automatically generated since!
409
410
411
412Eric Paris                  kubernetes User Manuals              KUBERNETES(1)
Impressum