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
38       namespace 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="none"
48           Must be "none", "server", or "client". If client strategy, only
49       print the object that would be sent, without sending it. If server
50       strategy, submit server-side request without persisting the resource.
51
52
53       --field-selector=""
54           Selector (field query) to filter on, supports '=', '==', and
55       '!='.(e.g. --field-selector key1=value1,key2=value2). The server only
56       supports a limited number of field queries per type.
57
58
59       -f, --filename=[]
60           Filename, directory, or URL to files identifying the resource to
61       update the annotation
62
63
64       -k, --kustomize=""
65           Process the kustomization directory. This flag can't be used
66       together with -f or -R.
67
68
69       --local=false
70           If true, annotation will NOT contact api-server but run locally.
71
72
73       -o, --output=""
74           Output format. One of:
75       json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.
76
77
78       --overwrite=false
79           If true, allow annotations to be overwritten, otherwise reject
80       annotation updates that overwrite existing annotations.
81
82
83       --record=false
84           Record current kubectl command in the resource annotation. If set
85       to false, do not record the command. If set to true, record the
86       command. If not set, default to updating the existing annotation value
87       only if one already exists.
88
89
90       -R, --recursive=false
91           Process the directory used in -f, --filename recursively. Useful
92       when you want to manage related manifests organized within the same
93       directory.
94
95
96       --resource-version=""
97           If non-empty, the annotation update will only succeed if this is
98       the current resource-version for the object. Only valid when specifying
99       a single resource.
100
101
102       -l, --selector=""
103           Selector (label query) to filter on, not including uninitialized
104       ones, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2).
105
106
107       --template=""
108           Template string or path to template file to use when
109       -o=go-template, -o=go-template-file. The template format is golang
110       templates [ ⟨http://golang.org/pkg/text/template/#pkg-overview⟩].
111
112
113

OPTIONS INHERITED FROM PARENT COMMANDS

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

EXAMPLE

417                # Update pod 'foo' with the annotation 'description' and the value 'my frontend'.
418                # If the same annotation is set multiple times, only the last value will be applied
419                kubectl annotate pods foo description='my frontend'
420
421                # Update a pod identified by type and name in "pod.json"
422                kubectl annotate -f pod.json description='my frontend'
423
424                # Update pod 'foo' with the annotation 'description' and the value 'my frontend running nginx', overwriting any existing value.
425                kubectl annotate --overwrite pods foo description='my frontend running nginx'
426
427                # Update all pods in the namespace
428                kubectl annotate pods --all description='my frontend running nginx'
429
430                # Update pod 'foo' only if the resource is unchanged from version 1.
431                kubectl annotate pods foo description='my frontend running nginx' --resource-version=1
432
433                # Update pod 'foo' by removing an annotation named 'description' if it exists.
434                # Does not require the --overwrite flag.
435                kubectl annotate pods foo description-
436
437
438
439

SEE ALSO

441       kubectl(1),
442
443
444

HISTORY

446       January 2015, Originally compiled by Eric Paris (eparis at redhat dot
447       com) based on the kubernetes source material, but hopefully they have
448       been automatically generated since!
449
450
451
452Eric Paris                  kubernetes User Manuals              KUBERNETES(1)
Impressum