1KUBERNETES(1)(kubernetes) KUBERNETES(1)(kubernetes)
2
3
4
5Eric Paris Jan 2015
6
7
9 kubectl edit - Edit a resource on the server
10
11
12
14 kubectl edit [OPTIONS]
15
16
17
19 Edit a resource from the default editor.
20
21
22 The edit command allows you to directly edit any API resource you can
23 retrieve via the command-line tools. It will open the editor defined by
24 your KUBE_EDITOR, or EDITOR environment variables, or fall back to 'vi'
25 for Linux or 'notepad' for Windows. You can edit multiple objects, al‐
26 though changes are applied one at a time. The command accepts file
27 names as well as command-line arguments, although the files you point
28 to must be previously saved versions of resources.
29
30
31 Editing is done with the API version used to fetch the resource. To
32 edit using a specific API version, fully-qualify the resource, version,
33 and group.
34
35
36 The default format is YAML. To edit in JSON, specify "-o json".
37
38
39 The flag --windows-line-endings can be used to force Windows line end‐
40 ings, otherwise the default for your operating system will be used.
41
42
43 In the event an error occurs while updating, a temporary file will be
44 created on disk that contains your unapplied changes. The most common
45 error when updating a resource is another editor changing the resource
46 on the server. When this occurs, you will have to apply your changes to
47 the newer version of the resource, or update your temporary saved copy
48 to include the latest resource version.
49
50
51
53 --allow-missing-template-keys=true If true, ignore any errors in
54 templates when a field or map key is missing in the template. Only ap‐
55 plies to golang and jsonpath output formats.
56
57
58 --field-manager="kubectl-edit" Name of the manager used to track
59 field ownership.
60
61
62 -f, --filename=[] Filename, directory, or URL to files to use to
63 edit the resource
64
65
66 -k, --kustomize="" Process the kustomization directory. This flag
67 can't be used together with -f or -R.
68
69
70 -o, --output="" Output format. One of: (json, yaml, name, go-tem‐
71 plate, go-template-file, template, templatefile, jsonpath, jsonpath-as-
72 json, jsonpath-file).
73
74
75 --output-patch=false Output the patch if the resource is edited.
76
77
78 --record=false Record current kubectl command in the resource an‐
79 notation. If set to false, do not record the command. If set to true,
80 record the command. If not set, default to updating the existing anno‐
81 tation value only if one already exists.
82
83
84 -R, --recursive=false Process the directory used in -f, --filename
85 recursively. Useful when you want to manage related manifests organized
86 within the same directory.
87
88
89 --save-config=false If true, the configuration of current object
90 will be saved in its annotation. Otherwise, the annotation will be un‐
91 changed. This flag is useful when you want to perform kubectl apply on
92 this object in the future.
93
94
95 --show-managed-fields=false If true, keep the managedFields when
96 printing objects in JSON or YAML format.
97
98
99 --subresource="" If specified, edit will operate on the subre‐
100 source of the requested object. Must be one of [status]. This flag is
101 beta and may change in the future.
102
103
104 --template="" Template string or path to template file to use when
105 -o=go-template, -o=go-template-file. The template format is golang tem‐
106 plates [http://golang.org/pkg/text/template/#pkg-overview].
107
108
109 --validate="strict" Must be one of: strict (or true), warn, ignore
110 (or false). "true" or "strict" will use a schema to validate
111 the input and fail the request if invalid. It will perform server side
112 validation if ServerSideFieldValidation is enabled on the api-server,
113 but will fall back to less reliable client-side validation if not.
114 "warn" will warn about unknown or duplicate fields without
115 blocking the request if server-side field validation is enabled on the
116 API server, and behave as "ignore" otherwise. "false" or
117 "ignore" will not perform any schema validation, silently dropping any
118 unknown or duplicate fields.
119
120
121 --windows-line-endings=false Defaults to the line ending native to
122 your platform.
123
124
125
127 --as="" Username to impersonate for the operation. User could be a
128 regular user or a service account in a namespace.
129
130
131 --as-group=[] Group to impersonate for the operation, this flag
132 can be repeated to specify multiple groups.
133
134
135 --as-uid="" UID to impersonate for the operation.
136
137
138 --azure-container-registry-config="" Path to the file containing
139 Azure container registry configuration information.
140
141
142 --cache-dir="/builddir/.kube/cache" Default cache directory
143
144
145 --certificate-authority="" Path to a cert file for the certificate
146 authority
147
148
149 --client-certificate="" Path to a client certificate file for TLS
150
151
152 --client-key="" Path to a client key file for TLS
153
154
155 --cluster="" The name of the kubeconfig cluster to use
156
157
158 --context="" The name of the kubeconfig context to use
159
160
161 --disable-compression=false If true, opt-out of response compres‐
162 sion for all requests to the server
163
164
165 --insecure-skip-tls-verify=false If true, the server's certificate
166 will not be checked for validity. This will make your HTTPS connections
167 insecure
168
169
170 --kubeconfig="" Path to the kubeconfig file to use for CLI re‐
171 quests.
172
173
174 --match-server-version=false Require server version to match
175 client version
176
177
178 -n, --namespace="" If present, the namespace scope for this CLI
179 request
180
181
182 --password="" Password for basic authentication to the API server
183
184
185 --profile="none" Name of profile to capture. One of
186 (none|cpu|heap|goroutine|threadcreate|block|mutex)
187
188
189 --profile-output="profile.pprof" Name of the file to write the
190 profile to
191
192
193 --request-timeout="0" The length of time to wait before giving up
194 on a single server request. Non-zero values should contain a corre‐
195 sponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't time‐
196 out requests.
197
198
199 -s, --server="" The address and port of the Kubernetes API server
200
201
202 --tls-server-name="" Server name to use for server certificate
203 validation. If it is not provided, the hostname used to contact the
204 server is used
205
206
207 --token="" Bearer token for authentication to the API server
208
209
210 --user="" The name of the kubeconfig user to use
211
212
213 --username="" Username for basic authentication to the API server
214
215
216 --version=false Print version information and quit
217
218
219 --warnings-as-errors=false Treat warnings received from the server
220 as errors and exit with a non-zero exit code
221
222
223
225 # Edit the service named 'registry'
226 kubectl edit svc/registry
227
228 # Use an alternative editor
229 KUBE_EDITOR="nano" kubectl edit svc/registry
230
231 # Edit the job 'myjob' in JSON using the v1 API format
232 kubectl edit job.v1.batch/myjob -o json
233
234 # Edit the deployment 'mydeployment' in YAML and save the modified config in its annotation
235 kubectl edit deployment/mydeployment -o yaml --save-config
236
237 # Edit the deployment/mydeployment's status subresource
238 kubectl edit deployment mydeployment --subresource='status'
239
240
241
242
244 kubectl(1),
245
246
247
249 January 2015, Originally compiled by Eric Paris (eparis at redhat dot
250 com) based on the kubernetes source material, but hopefully they have
251 been automatically generated since!
252
253
254
255Manuals User KUBERNETES(1)(kubernetes)