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 alpha 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 --insecure-skip-tls-verify=false If true, the server's certificate
162 will not be checked for validity. This will make your HTTPS connections
163 insecure
164
165
166 --kubeconfig="" Path to the kubeconfig file to use for CLI re‐
167 quests.
168
169
170 --match-server-version=false Require server version to match
171 client version
172
173
174 -n, --namespace="" If present, the namespace scope for this CLI
175 request
176
177
178 --password="" Password for basic authentication to the API server
179
180
181 --profile="none" Name of profile to capture. One of
182 (none|cpu|heap|goroutine|threadcreate|block|mutex)
183
184
185 --profile-output="profile.pprof" Name of the file to write the
186 profile to
187
188
189 --request-timeout="0" The length of time to wait before giving up
190 on a single server request. Non-zero values should contain a corre‐
191 sponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't time‐
192 out requests.
193
194
195 -s, --server="" The address and port of the Kubernetes API server
196
197
198 --tls-server-name="" Server name to use for server certificate
199 validation. If it is not provided, the hostname used to contact the
200 server is used
201
202
203 --token="" Bearer token for authentication to the API server
204
205
206 --user="" The name of the kubeconfig user to use
207
208
209 --username="" Username for basic authentication to the API server
210
211
212 --version=false Print version information and quit
213
214
215 --warnings-as-errors=false Treat warnings received from the server
216 as errors and exit with a non-zero exit code
217
218
219
221 # Edit the service named 'registry'
222 kubectl edit svc/registry
223
224 # Use an alternative editor
225 KUBE_EDITOR="nano" kubectl edit svc/registry
226
227 # Edit the job 'myjob' in JSON using the v1 API format
228 kubectl edit job.v1.batch/myjob -o json
229
230 # Edit the deployment 'mydeployment' in YAML and save the modified config in its annotation
231 kubectl edit deployment/mydeployment -o yaml --save-config
232
233 # Edit the deployment/mydeployment's status subresource
234 kubectl edit deployment mydeployment --subresource='status'
235
236
237
238
240 kubectl(1),
241
242
243
245 January 2015, Originally compiled by Eric Paris (eparis at redhat dot
246 com) based on the kubernetes source material, but hopefully they have
247 been automatically generated since!
248
249
250
251Manuals User KUBERNETES(1)(kubernetes)