1KUBERNETES(1)(kubernetes) KUBERNETES(1)(kubernetes)
2
3
4
5Eric Paris Jan 2015
6
7
9 kubectl annotate - Update the annotations on a resource
10
11
12
14 kubectl annotate [OPTIONS]
15
16
17
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
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
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 --insecure-skip-tls-verify=false If true, the server's certificate
160 will not be checked for validity. This will make your HTTPS connections
161 insecure
162
163
164 --kubeconfig="" Path to the kubeconfig file to use for CLI re‐
165 quests.
166
167
168 --match-server-version=false Require server version to match
169 client version
170
171
172 -n, --namespace="" If present, the namespace scope for this CLI
173 request
174
175
176 --password="" Password for basic authentication to the API server
177
178
179 --profile="none" Name of profile to capture. One of
180 (none|cpu|heap|goroutine|threadcreate|block|mutex)
181
182
183 --profile-output="profile.pprof" Name of the file to write the
184 profile to
185
186
187 --request-timeout="0" The length of time to wait before giving up
188 on a single server request. Non-zero values should contain a corre‐
189 sponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't time‐
190 out requests.
191
192
193 -s, --server="" The address and port of the Kubernetes API server
194
195
196 --tls-server-name="" Server name to use for server certificate
197 validation. If it is not provided, the hostname used to contact the
198 server is used
199
200
201 --token="" Bearer token for authentication to the API server
202
203
204 --user="" The name of the kubeconfig user to use
205
206
207 --username="" Username for basic authentication to the API server
208
209
210 --version=false Print version information and quit
211
212
213 --warnings-as-errors=false Treat warnings received from the server
214 as errors and exit with a non-zero exit code
215
216
217
219 # Update pod 'foo' with the annotation 'description' and the value 'my frontend'
220 # If the same annotation is set multiple times, only the last value will be applied
221 kubectl annotate pods foo description='my frontend'
222
223 # Update a pod identified by type and name in "pod.json"
224 kubectl annotate -f pod.json description='my frontend'
225
226 # Update pod 'foo' with the annotation 'description' and the value 'my frontend running nginx', overwriting any existing value
227 kubectl annotate --overwrite pods foo description='my frontend running nginx'
228
229 # Update all pods in the namespace
230 kubectl annotate pods --all description='my frontend running nginx'
231
232 # Update pod 'foo' only if the resource is unchanged from version 1
233 kubectl annotate pods foo description='my frontend running nginx' --resource-version=1
234
235 # Update pod 'foo' by removing an annotation named 'description' if it exists
236 # Does not require the --overwrite flag
237 kubectl annotate pods foo description-
238
239
240
241
243 kubectl(1),
244
245
246
248 January 2015, Originally compiled by Eric Paris (eparis at redhat dot
249 com) based on the kubernetes source material, but hopefully they have
250 been automatically generated since!
251
252
253
254Manuals User KUBERNETES(1)(kubernetes)