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

OPTIONS INHERITED FROM PARENT COMMANDS

125       --as=""      Username to impersonate for the operation. User could be a
126       regular user or a service account in a namespace.
127
128
129       --as-group=[]      Group to impersonate for the  operation,  this  flag
130       can be repeated to specify multiple groups.
131
132
133       --as-uid=""      UID to impersonate for the operation.
134
135
136       --azure-container-registry-config=""       Path  to the file containing
137       Azure container registry configuration information.
138
139
140       --cache-dir="/builddir/.kube/cache"      Default cache directory
141
142
143       --certificate-authority=""      Path to a cert file for the certificate
144       authority
145
146
147       --client-certificate=""      Path to a client certificate file for TLS
148
149
150       --client-key=""      Path to a client key file for TLS
151
152
153       --cluster=""      The name of the kubeconfig cluster to use
154
155
156       --context=""      The name of the kubeconfig context to use
157
158
159       --disable-compression=false       If true, opt-out of response compres‐
160       sion for all requests to the server
161
162
163       --insecure-skip-tls-verify=false      If true, the server's certificate
164       will not be checked for validity. This will make your HTTPS connections
165       insecure
166
167
168       --kubeconfig=""      Path to the kubeconfig file to  use  for  CLI  re‐
169       quests.
170
171
172       --match-server-version=false        Require  server  version  to  match
173       client version
174
175
176       -n, --namespace=""      If present, the namespace scope  for  this  CLI
177       request
178
179
180       --password=""      Password for basic authentication to the API server
181
182
183       --profile="none"         Name   of   profile   to   capture.   One   of
184       (none|cpu|heap|goroutine|threadcreate|block|mutex)
185
186
187       --profile-output="profile.pprof"      Name of the  file  to  write  the
188       profile to
189
190
191       --request-timeout="0"       The length of time to wait before giving up
192       on a single server request. Non-zero values  should  contain  a  corre‐
193       sponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't time‐
194       out requests.
195
196
197       -s, --server=""      The address and port of the Kubernetes API server
198
199
200       --tls-server-name=""      Server name to  use  for  server  certificate
201       validation.  If  it  is  not provided, the hostname used to contact the
202       server is used
203
204
205       --token=""      Bearer token for authentication to the API server
206
207
208       --user=""      The name of the kubeconfig user to use
209
210
211       --username=""      Username for basic authentication to the API server
212
213
214       --version=false      Print version information and quit
215
216
217       --warnings-as-errors=false      Treat warnings received from the server
218       as errors and exit with a non-zero exit code
219
220
221

EXAMPLE

223                # Update pod 'foo' with the annotation 'description' and the value 'my frontend'
224                # If the same annotation is set multiple times, only the last value will be applied
225                kubectl annotate pods foo description='my frontend'
226
227                # Update a pod identified by type and name in "pod.json"
228                kubectl annotate -f pod.json description='my frontend'
229
230                # Update pod 'foo' with the annotation 'description' and the value 'my frontend running nginx', overwriting any existing value
231                kubectl annotate --overwrite pods foo description='my frontend running nginx'
232
233                # Update all pods in the namespace
234                kubectl annotate pods --all description='my frontend running nginx'
235
236                # Update pod 'foo' only if the resource is unchanged from version 1
237                kubectl annotate pods foo description='my frontend running nginx' --resource-version=1
238
239                # Update pod 'foo' by removing an annotation named 'description' if it exists
240                # Does not require the --overwrite flag
241                kubectl annotate pods foo description-
242
243
244
245

SEE ALSO

247       kubectl(1),
248
249
250

HISTORY

252       January  2015,  Originally compiled by Eric Paris (eparis at redhat dot
253       com) based on the kubernetes source material, but hopefully  they  have
254       been automatically generated since!
255
256
257
258Manuals                              User            KUBERNETES(1)(kubernetes)
Impressum