1KUBERNETES(1) Jan 2015 KUBERNETES(1)
2
3
4
6 kubectl edit - Edit a resource on the server
7
8
9
11 kubectl edit [OPTIONS]
12
13
14
16 Edit a resource from the default editor.
17
18
19 The edit command allows you to directly edit any API resource you can
20 retrieve via the command line tools. It will open the editor defined by
21 your KUBE_EDITOR, or EDITOR environment variables, or fall back to 'vi'
22 for Linux or 'notepad' for Windows. You can edit multiple objects,
23 although changes are applied one at a time. The command accepts file‐
24 names as well as command line arguments, although the files you point
25 to must be previously saved versions of resources.
26
27
28 Editing is done with the API version used to fetch the resource. To
29 edit using a specific API version, fully-qualify the resource, version,
30 and group.
31
32
33 The default format is YAML. To edit in JSON, specify "-o json".
34
35
36 The flag --windows-line-endings can be used to force Windows line end‐
37 ings, otherwise the default for your operating system will be used.
38
39
40 In the event an error occurs while updating, a temporary file will be
41 created on disk that contains your unapplied changes. The most common
42 error when updating a resource is another editor changing the resource
43 on the server. When this occurs, you will have to apply your changes to
44 the newer version of the resource, or update your temporary saved copy
45 to include the latest resource version.
46
47
48
50 --allow-missing-template-keys=true
51 If true, ignore any errors in templates when a field or map key is
52 missing in the template. Only applies to golang and jsonpath output
53 formats.
54
55
56 -f, --filename=[]
57 Filename, directory, or URL to files to use to edit the resource
58
59
60 --include-uninitialized=false
61 If true, the kubectl command applies to uninitialized objects. If
62 explicitly set to false, this flag overrides other flags that make the
63 kubectl commands apply to uninitialized objects, e.g., "--all". Objects
64 with empty metadata.initializers are regarded as initialized.
65
66
67 -k, --kustomize=""
68 Process the kustomization directory. This flag can't be used
69 together with -f or -R.
70
71
72 -o, --output=""
73 Output format. One of: json|yaml|name|go-template|go-tem‐
74 plate-file|template|templatefile|jsonpath|jsonpath-file.
75
76
77 --output-patch=false
78 Output the patch if the resource is edited.
79
80
81 --record=false
82 Record current kubectl command in the resource annotation. If set
83 to false, do not record the command. If set to true, record the com‐
84 mand. If not set, default to updating the existing annotation value
85 only if one already exists.
86
87
88 -R, --recursive=false
89 Process the directory used in -f, --filename recursively. Useful
90 when you want to manage related manifests organized within the same
91 directory.
92
93
94 --save-config=false
95 If true, the configuration of current object will be saved in its
96 annotation. Otherwise, the annotation will be unchanged. This flag is
97 useful when you want to perform kubectl apply on this object in the
98 future.
99
100
101 --template=""
102 Template string or path to template file to use when -o=go-tem‐
103 plate, -o=go-template-file. The template format is golang templates [
104 ⟨http://golang.org/pkg/text/template/#pkg-overview⟩].
105
106
107 --validate=true
108 If true, use a schema to validate the input before sending it
109
110
111 --windows-line-endings=false
112 Defaults to the line ending native to your platform.
113
114
115
117 --alsologtostderr=false
118 log to standard error as well as files
119
120
121 --application-metrics-count-limit=100
122 Max number of application metrics to store (per container)
123
124
125 --as=""
126 Username to impersonate for the operation
127
128
129 --as-group=[]
130 Group to impersonate for the operation, this flag can be repeated
131 to specify multiple groups.
132
133
134 --azure-container-registry-config=""
135 Path to the file containing Azure container registry configuration
136 information.
137
138
139 --boot-id-file="/proc/sys/kernel/random/boot_id"
140 Comma-separated list of files to check for boot-id. Use the first
141 one that exists.
142
143
144 --cache-dir="/builddir/.kube/http-cache"
145 Default HTTP cache directory
146
147
148 --certificate-authority=""
149 Path to a cert file for the certificate authority
150
151
152 --client-certificate=""
153 Path to a client certificate file for TLS
154
155
156 --client-key=""
157 Path to a client key file for TLS
158
159
160 --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
161 CIDRs opened in GCE firewall for LB traffic proxy health checks
162
163
164 --cluster=""
165 The name of the kubeconfig cluster to use
166
167
168 --container-hints="/etc/cadvisor/container_hints.json"
169 location of the container hints file
170
171
172 --containerd="/run/containerd/containerd.sock"
173 containerd endpoint
174
175
176 --containerd-namespace="k8s.io"
177 containerd namespace
178
179
180 --context=""
181 The name of the kubeconfig context to use
182
183
184 --default-not-ready-toleration-seconds=300
185 Indicates the tolerationSeconds of the toleration for
186 notReady:NoExecute that is added by default to every pod that does not
187 already have such a toleration.
188
189
190 --default-unreachable-toleration-seconds=300
191 Indicates the tolerationSeconds of the toleration for unreach‐
192 able:NoExecute that is added by default to every pod that does not
193 already have such a toleration.
194
195
196 --docker="unix:///var/run/docker.sock"
197 docker endpoint
198
199
200 --docker-env-metadata-whitelist=""
201 a comma-separated list of environment variable keys that needs to
202 be collected for docker containers
203
204
205 --docker-only=false
206 Only report docker containers in addition to root stats
207
208
209 --docker-root="/var/lib/docker"
210 DEPRECATED: docker root is read from docker info (this is a fall‐
211 back, default: /var/lib/docker)
212
213
214 --docker-tls=false
215 use TLS to connect to docker
216
217
218 --docker-tls-ca="ca.pem"
219 path to trusted CA
220
221
222 --docker-tls-cert="cert.pem"
223 path to client certificate
224
225
226 --docker-tls-key="key.pem"
227 path to private key
228
229
230 --enable-load-reader=false
231 Whether to enable cpu load reader
232
233
234 --event-storage-age-limit="default=0"
235 Max length of time for which to store events (per type). Value is a
236 comma separated list of key values, where the keys are event types
237 (e.g.: creation, oom) or "default" and the value is a duration. Default
238 is applied to all non-specified event types
239
240
241 --event-storage-event-limit="default=0"
242 Max number of events to store (per type). Value is a comma sepa‐
243 rated list of key values, where the keys are event types (e.g.: cre‐
244 ation, oom) or "default" and the value is an integer. Default is
245 applied to all non-specified event types
246
247
248 --global-housekeeping-interval=1m0s
249 Interval between global housekeepings
250
251
252 --housekeeping-interval=10s
253 Interval between container housekeepings
254
255
256 --insecure-skip-tls-verify=false
257 If true, the server's certificate will not be checked for validity.
258 This will make your HTTPS connections insecure
259
260
261 --kubeconfig=""
262 Path to the kubeconfig file to use for CLI requests.
263
264
265 --log-backtrace-at=:0
266 when logging hits line file:N, emit a stack trace
267
268
269 --log-cadvisor-usage=false
270 Whether to log the usage of the cAdvisor container
271
272
273 --log-dir=""
274 If non-empty, write log files in this directory
275
276
277 --log-file=""
278 If non-empty, use this log file
279
280
281 --log-file-max-size=1800
282 Defines the maximum size a log file can grow to. Unit is megabytes.
283 If the value is 0, the maximum file size is unlimited.
284
285
286 --log-flush-frequency=5s
287 Maximum number of seconds between log flushes
288
289
290 --logtostderr=true
291 log to standard error instead of files
292
293
294 --machine-id-file="/etc/machine-id,/var/lib/dbus/machine-id"
295 Comma-separated list of files to check for machine-id. Use the
296 first one that exists.
297
298
299 --match-server-version=false
300 Require server version to match client version
301
302
303 -n, --namespace=""
304 If present, the namespace scope for this CLI request
305
306
307 --password=""
308 Password for basic authentication to the API server
309
310
311 --profile="none"
312 Name of profile to capture. One of (none|cpu|heap|goroutine|thread‐
313 create|block|mutex)
314
315
316 --profile-output="profile.pprof"
317 Name of the file to write the profile to
318
319
320 --request-timeout="0"
321 The length of time to wait before giving up on a single server
322 request. Non-zero values should contain a corresponding time unit (e.g.
323 1s, 2m, 3h). A value of zero means don't timeout requests.
324
325
326 -s, --server=""
327 The address and port of the Kubernetes API server
328
329
330 --skip-headers=false
331 If true, avoid header prefixes in the log messages
332
333
334 --skip-log-headers=false
335 If true, avoid headers when opening log files
336
337
338 --stderrthreshold=2
339 logs at or above this threshold go to stderr
340
341
342 --storage-driver-buffer-duration=1m0s
343 Writes in the storage driver will be buffered for this duration,
344 and committed to the non memory backends as a single transaction
345
346
347 --storage-driver-db="cadvisor"
348 database name
349
350
351 --storage-driver-host="localhost:8086"
352 database host:port
353
354
355 --storage-driver-password="root"
356 database password
357
358
359 --storage-driver-secure=false
360 use secure connection with database
361
362
363 --storage-driver-table="stats"
364 table name
365
366
367 --storage-driver-user="root"
368 database username
369
370
371 --token=""
372 Bearer token for authentication to the API server
373
374
375 --update-machine-info-interval=5m0s
376 Interval between machine info updates.
377
378
379 --user=""
380 The name of the kubeconfig user to use
381
382
383 --username=""
384 Username for basic authentication to the API server
385
386
387 -v, --v=0
388 number for the log level verbosity
389
390
391 --version=false
392 Print version information and quit
393
394
395 --vmodule=
396 comma-separated list of pattern=N settings for file-filtered log‐
397 ging
398
399
400
402 # Edit the service named 'docker-registry':
403 kubectl edit svc/docker-registry
404
405 # Use an alternative editor
406 KUBE_EDITOR="nano" kubectl edit svc/docker-registry
407
408 # Edit the job 'myjob' in JSON using the v1 API format:
409 kubectl edit job.v1.batch/myjob -o json
410
411 # Edit the deployment 'mydeployment' in YAML and save the modified config in its annotation:
412 kubectl edit deployment/mydeployment -o yaml --save-config
413
414
415
416
418 kubectl(1),
419
420
421
423 January 2015, Originally compiled by Eric Paris (eparis at redhat dot
424 com) based on the kubernetes source material, but hopefully they have
425 been automatically generated since!
426
427
428
429Eric Paris kubernetes User Manuals KUBERNETES(1)