1KUBERNETES(1)(kubernetes)                            KUBERNETES(1)(kubernetes)
2
3
4
5Eric Paris Jan 2015
6
7

NAME

9       kubectl edit - Edit a resource on the server
10
11
12

SYNOPSIS

14       kubectl edit [OPTIONS]
15
16
17

DESCRIPTION

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 filenames
27       as well as command line arguments, although the files you point to must
28       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

OPTIONS

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|json‐
72       path-as-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       --template=""      Template string or path to template file to use when
100       -o=go-template, -o=go-template-file. The template format is golang tem‐
101       plates [http://golang.org/pkg/text/template/#pkg-overview].
102
103
104       --validate=true      If true, use a schema to validate the input before
105       sending it
106
107
108       --windows-line-endings=false      Defaults to the line ending native to
109       your platform.
110
111
112

OPTIONS INHERITED FROM PARENT COMMANDS

114       --add-dir-header=false       If  true,  adds  the file directory to the
115       header of the log messages
116
117
118       --alsologtostderr=false      log to standard error as well as files
119
120
121       --application-metrics-count-limit=100      Max  number  of  application
122       metrics to store (per container)
123
124
125       --as=""      Username to impersonate for the operation
126
127
128       --as-group=[]       Group  to  impersonate for the operation, this flag
129       can be repeated to specify multiple groups.
130
131
132       --azure-container-registry-config=""      Path to the  file  containing
133       Azure container registry configuration information.
134
135
136       --boot-id-file="/proc/sys/kernel/random/boot_id"        Comma-separated
137       list of files to check for boot-id. Use the first one that exists.
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       --cloud-provider-gce-l7lb-src-cidrs=130.211.0.0/22,35.191.0.0/16
154            CIDRs opened in GCE firewall for  L7  LB  traffic  proxy    health
155       checks
156
157
158       --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
159            CIDRs opened in GCE firewall for  L4  LB  traffic  proxy    health
160       checks
161
162
163       --cluster=""      The name of the kubeconfig cluster to use
164
165
166       --container-hints="/etc/cadvisor/container_hints.json"      location of
167       the container hints file
168
169
170       --containerd="/run/containerd/containerd.sock"      containerd endpoint
171
172
173       --containerd-namespace="k8s.io"      containerd namespace
174
175
176       --context=""      The name of the kubeconfig context to use
177
178
179       --default-not-ready-toleration-seconds=300      Indicates  the  tolera‐
180       tionSeconds  of  the toleration for notReady:NoExecute that is added by
181       default to every pod that does not already have such a toleration.
182
183
184       --default-unreachable-toleration-seconds=300      Indicates the tolera‐
185       tionSeconds  of  the toleration for unreachable:NoExecute that is added
186       by default to every pod that does not already have such a toleration.
187
188
189       --disable-root-cgroup-stats=false      Disable collecting  root  Cgroup
190       stats
191
192
193       --docker="unix:///var/run/docker.sock"      docker endpoint
194
195
196       --docker-env-metadata-whitelist=""      a comma-separated list of envi‐
197       ronment variable keys matched with specified prefix that  needs  to  be
198       collected for docker containers
199
200
201       --docker-only=false       Only  report docker containers in addition to
202       root stats
203
204
205       --docker-root="/var/lib/docker"      DEPRECATED: docker  root  is  read
206       from docker info (this is a fallback, default: /var/lib/docker)
207
208
209       --docker-tls=false      use TLS to connect to docker
210
211
212       --docker-tls-ca="ca.pem"      path to trusted CA
213
214
215       --docker-tls-cert="cert.pem"      path to client certificate
216
217
218       --docker-tls-key="key.pem"      path to private key
219
220
221       --enable-load-reader=false      Whether to enable cpu load reader
222
223
224       --event-storage-age-limit="default=0"      Max length of time for which
225       to store events (per type). Value is a comma separated list of key val‐
226       ues,  where the keys are event types (e.g.: creation, oom) or "default"
227       and the value is a duration. Default is applied  to  all  non-specified
228       event types
229
230
231       --event-storage-event-limit="default=0"       Max  number  of events to
232       store (per type). Value is a comma separated list of key values,  where
233       the  keys  are  event  types (e.g.: creation, oom) or "default" and the
234       value is an integer. Default is  applied  to  all  non-specified  event
235       types
236
237
238       --global-housekeeping-interval=1m0s      Interval between global house‐
239       keepings
240
241
242       --housekeeping-interval=10s      Interval between container  housekeep‐
243       ings
244
245
246       --insecure-skip-tls-verify=false      If true, the server's certificate
247       will not be checked for validity. This will make your HTTPS connections
248       insecure
249
250
251       --kubeconfig=""       Path  to  the  kubeconfig file to use for CLI re‐
252       quests.
253
254
255       --log-backtrace-at=:0      when logging hits line file:N, emit a  stack
256       trace
257
258
259       --log-cadvisor-usage=false       Whether to log the usage of the cAdvi‐
260       sor container
261
262
263       --log-dir=""      If non-empty, write log files in this directory
264
265
266       --log-file=""      If non-empty, use this log file
267
268
269       --log-file-max-size=1800      Defines the maximum size a log  file  can
270       grow to. Unit is megabytes. If the value is 0, the maximum file size is
271       unlimited.
272
273
274       --log-flush-frequency=5s      Maximum number  of  seconds  between  log
275       flushes
276
277
278       --logtostderr=true      log to standard error instead of files
279
280
281       --machine-id-file="/etc/machine-id,/var/lib/dbus/machine-id"
282            Comma-separated list of files to check  for  machine-id.  Use  the
283       first one that exists.
284
285
286       --match-server-version=false        Require  server  version  to  match
287       client version
288
289
290       -n, --namespace=""      If present, the namespace scope  for  this  CLI
291       request
292
293
294       --one-output=false      If true, only write logs to their native sever‐
295       ity level (vs also writing to each lower severity level)
296
297
298       --password=""      Password for basic authentication to the API server
299
300
301       --profile="none"        Name   of   profile   to   capture.   One    of
302       (none|cpu|heap|goroutine|threadcreate|block|mutex)
303
304
305       --profile-output="profile.pprof"       Name  of  the  file to write the
306       profile to
307
308
309       --referenced-reset-interval=0      Reset interval for referenced  bytes
310       (container_referenced_bytes metric), number of measurement cycles after
311       which referenced bytes are cleared, if set to 0  referenced  bytes  are
312       never cleared (default: 0)
313
314
315       --request-timeout="0"       The length of time to wait before giving up
316       on a single server request. Non-zero values  should  contain  a  corre‐
317       sponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't time‐
318       out requests.
319
320
321       -s, --server=""      The address and port of the Kubernetes API server
322
323
324       --skip-headers=false      If true, avoid header  prefixes  in  the  log
325       messages
326
327
328       --skip-log-headers=false       If  true, avoid headers when opening log
329       files
330
331
332       --stderrthreshold=2      logs at or above this threshold go to stderr
333
334
335       --storage-driver-buffer-duration=1m0s      Writes in the storage driver
336       will  be  buffered  for  this duration, and committed to the non memory
337       backends as a single transaction
338
339
340       --storage-driver-db="cadvisor"      database name
341
342
343       --storage-driver-host="localhost:8086"      database host:port
344
345
346       --storage-driver-password="root"      database password
347
348
349       --storage-driver-secure=false      use secure connection with database
350
351
352       --storage-driver-table="stats"      table name
353
354
355       --storage-driver-user="root"      database username
356
357
358       --tls-server-name=""      Server name to  use  for  server  certificate
359       validation.  If  it  is  not provided, the hostname used to contact the
360       server is used
361
362
363       --token=""      Bearer token for authentication to the API server
364
365
366       --update-machine-info-interval=5m0s      Interval between machine  info
367       updates.
368
369
370       --user=""      The name of the kubeconfig user to use
371
372
373       --username=""      Username for basic authentication to the API server
374
375
376       -v, --v=0      number for the log level verbosity
377
378
379       --version=false      Print version information and quit
380
381
382       --vmodule=        comma-separated   list   of  pattern=N  settings  for
383       file-filtered logging
384
385
386       --warnings-as-errors=false      Treat warnings received from the server
387       as errors and exit with a non-zero exit code
388
389
390

EXAMPLE

392                # Edit the service named 'docker-registry':
393                kubectl edit svc/docker-registry
394
395                # Use an alternative editor
396                KUBE_EDITOR="nano" kubectl edit svc/docker-registry
397
398                # Edit the job 'myjob' in JSON using the v1 API format:
399                kubectl edit job.v1.batch/myjob -o json
400
401                # Edit the deployment 'mydeployment' in YAML and save the modified config in its annotation:
402                kubectl edit deployment/mydeployment -o yaml --save-config
403
404
405
406

SEE ALSO

408       kubectl(1),
409
410
411

HISTORY

413       January  2015,  Originally compiled by Eric Paris (eparis at redhat dot
414       com) based on the kubernetes source material, but hopefully  they  have
415       been automatically generated since!
416
417
418
419Manuals                              User            KUBERNETES(1)(kubernetes)
Impressum