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