1KUBERNETES(1)                      Jan 2015                      KUBERNETES(1)
2
3
4

NAME

6       kubectl replace - Replace a resource by filename or stdin
7
8
9

SYNOPSIS

11       kubectl replace [OPTIONS]
12
13
14

DESCRIPTION

16       Replace a resource by filename or stdin.
17
18
19       JSON and YAML formats are accepted. If replacing an existing resource,
20       the complete resource spec must be provided. This can be obtained by
21
22
23       $ kubectl get TYPE NAME -o yaml
24
25
26

OPTIONS

28       --allow-missing-template-keys=true
29           If true, ignore any errors in templates when a field or map key is
30       missing in the template. Only applies to golang and jsonpath output
31       formats.
32
33
34       --cascade=true
35           If true, cascade the deletion of the resources managed by this
36       resource (e.g. Pods created by a ReplicationController).  Default true.
37
38
39       --dry-run="none"
40           Must be "none", "server", or "client". If client strategy, only
41       print the object that would be sent, without sending it. If server
42       strategy, submit server-side request without persisting the resource.
43
44
45       -f, --filename=[]
46           to use to replace the resource.
47
48
49       --force=false
50           If true, immediately remove resources from API and bypass graceful
51       deletion. Note that immediate deletion of some resources may result in
52       inconsistency or data loss and requires confirmation.
53
54
55       --grace-period=-1
56           Period of time in seconds given to the resource to terminate
57       gracefully. Ignored if negative. Set to 1 for immediate shutdown. Can
58       only be set to 0 when --force is true (force deletion).
59
60
61       -k, --kustomize=""
62           Process a kustomization directory. This flag can't be used together
63       with -f or -R.
64
65
66       -o, --output=""
67           Output format. One of:
68       json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.
69
70
71       --raw=""
72           Raw URI to PUT to the server.  Uses the transport specified by the
73       kubeconfig file.
74
75
76       -R, --recursive=false
77           Process the directory used in -f, --filename recursively. Useful
78       when you want to manage related manifests organized within the same
79       directory.
80
81
82       --save-config=false
83           If true, the configuration of current object will be saved in its
84       annotation. Otherwise, the annotation will be unchanged. This flag is
85       useful when you want to perform kubectl apply on this object in the
86       future.
87
88
89       --template=""
90           Template string or path to template file to use when
91       -o=go-template, -o=go-template-file. The template format is golang
92       templates [ ⟨http://golang.org/pkg/text/template/#pkg-overview⟩].
93
94
95       --timeout=0s
96           The length of time to wait before giving up on a delete, zero means
97       determine a timeout from the size of the object
98
99
100       --validate=true
101           If true, use a schema to validate the input before sending it
102
103
104       --wait=false
105           If true, wait for resources to be gone before returning. This waits
106       for finalizers.
107
108
109

OPTIONS INHERITED FROM PARENT COMMANDS

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

EXAMPLE

413                # Replace a pod using the data in pod.json.
414                kubectl replace -f ./pod.json
415
416                # Replace a pod based on the JSON passed into stdin.
417                cat pod.json | kubectl replace -f -
418
419                # Update a single-container pod's image version (tag) to v4
420                kubectl get pod mypod -o yaml | sed 's/\(image: myimage\):.*$/\1:v4/' | kubectl replace -f -
421
422                # Force replace, delete and then re-create the resource
423                kubectl replace --force -f ./pod.json
424
425
426
427

SEE ALSO

429       kubectl(1),
430
431
432

HISTORY

434       January 2015, Originally compiled by Eric Paris (eparis at redhat dot
435       com) based on the kubernetes source material, but hopefully they have
436       been automatically generated since!
437
438
439
440Eric Paris                  kubernetes User Manuals              KUBERNETES(1)
Impressum