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       Please     refer     to     the     models     in     ⟨https://htmlpre
27       view.github.io/?https://github.com/kubernetes/kuber
28       netes/blob/HEAD/docs/api-reference/v1/definitions.html⟩ to  find  if  a
29       field is mutable.
30
31
32

OPTIONS

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

OPTIONS INHERITED FROM PARENT COMMANDS

102       --allow-verification-with-non-compliant-keys=false
103           Allow  a  SignatureVerifier  to  use  keys  which  are  technically
104       non-compliant with RFC6962.
105
106
107       --alsologtostderr=false
108           log to standard error as well as files
109
110
111       --application-metrics-count-limit=100
112           Max number of application metrics to store (per container)
113
114
115       --as=""
116           Username to impersonate for the operation
117
118
119       --as-group=[]
120           Group to impersonate for the operation, this flag can  be  repeated
121       to specify multiple groups.
122
123
124       --azure-container-registry-config=""
125           Path  to the file containing Azure container registry configuration
126       information.
127
128
129       --boot-id-file="/proc/sys/kernel/random/boot_id"
130           Comma-separated list of files to check for boot-id. Use  the  first
131       one that exists.
132
133
134       --cache-dir="/builddir/.kube/http-cache"
135           Default HTTP cache directory
136
137
138       --certificate-authority=""
139           Path to a cert file for the certificate authority
140
141
142       --client-certificate=""
143           Path to a client certificate file for TLS
144
145
146       --client-key=""
147           Path to a client key file for TLS
148
149
150       --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
151           CIDRs opened in GCE firewall for LB traffic proxy  health checks
152
153
154       --cluster=""
155           The name of the kubeconfig cluster to use
156
157
158       --container-hints="/etc/cadvisor/container_hints.json"
159           location of the container hints file
160
161
162       --containerd="unix:///var/run/containerd.sock"
163           containerd endpoint
164
165
166       --context=""
167           The name of the kubeconfig context to use
168
169
170       --default-not-ready-toleration-seconds=300
171           Indicates   the   tolerationSeconds   of   the    toleration    for
172       notReady:NoExecute  that is added by default to every pod that does not
173       already have such a toleration.
174
175
176       --default-unreachable-toleration-seconds=300
177           Indicates the tolerationSeconds  of  the  toleration  for  unreach‐
178       able:NoExecute  that  is  added  by  default to every pod that does not
179       already have such a toleration.
180
181
182       --docker="unix:///var/run/docker.sock"
183           docker endpoint
184
185
186       --docker-env-metadata-whitelist=""
187           a comma-separated list of environment variable keys that  needs  to
188       be collected for docker containers
189
190
191       --docker-only=false
192           Only report docker containers in addition to root stats
193
194
195       --docker-root="/var/lib/docker"
196           DEPRECATED:  docker  root is read from docker info (this is a fall‐
197       back, default: /var/lib/docker)
198
199
200       --docker-tls=false
201           use TLS to connect to docker
202
203
204       --docker-tls-ca="ca.pem"
205           path to trusted CA
206
207
208       --docker-tls-cert="cert.pem"
209           path to client certificate
210
211
212       --docker-tls-key="key.pem"
213           path to private key
214
215
216       --enable-load-reader=false
217           Whether to enable cpu load reader
218
219
220       --event-storage-age-limit="default=0"
221           Max length of time for which to store events (per type). Value is a
222       comma  separated  list  of  key  values, where the keys are event types
223       (e.g.: creation, oom) or "default" and the value is a duration. Default
224       is applied to all non-specified event types
225
226
227       --event-storage-event-limit="default=0"
228           Max  number  of  events to store (per type). Value is a comma sepa‐
229       rated list of key values, where the keys are event  types  (e.g.:  cre‐
230       ation,  oom)  or  "default"  and  the  value  is an integer. Default is
231       applied to all non-specified event types
232
233
234       --global-housekeeping-interval=1m0s
235           Interval between global housekeepings
236
237
238       --google-json-key=""
239           The Google Cloud Platform Service  Account  JSON  Key  to  use  for
240       authentication.
241
242
243       --housekeeping-interval=10s
244           Interval between container housekeepings
245
246
247       --insecure-skip-tls-verify=false
248           If true, the server's certificate will not be checked for validity.
249       This will make your HTTPS connections insecure
250
251
252       --kubeconfig=""
253           Path to the kubeconfig file to use for CLI requests.
254
255
256       --log-backtrace-at=:0
257           when logging hits line file:N, emit a stack trace
258
259
260       --log-cadvisor-usage=false
261           Whether to log the usage of the cAdvisor container
262
263
264       --log-dir=""
265           If non-empty, write log files in this directory
266
267
268       --log-flush-frequency=5s
269           Maximum number of seconds between log flushes
270
271
272       --logtostderr=true
273           log to standard error instead of files
274
275
276       --machine-id-file="/etc/machine-id,/var/lib/dbus/machine-id"
277           Comma-separated list of files to  check  for  machine-id.  Use  the
278       first one that exists.
279
280
281       --match-server-version=false
282           Require server version to match client version
283
284
285       --mesos-agent="127.0.0.1:5051"
286           Mesos agent address
287
288
289       --mesos-agent-timeout=10s
290           Mesos agent timeout
291
292
293       -n, --namespace=""
294           If present, the namespace scope for this CLI request
295
296
297       --request-timeout="0"
298           The  length  of  time  to  wait before giving up on a single server
299       request. Non-zero values should contain a corresponding time unit (e.g.
300       1s, 2m, 3h). A value of zero means don't timeout requests.
301
302
303       -s, --server=""
304           The address and port of the Kubernetes API server
305
306
307       --stderrthreshold=2
308           logs at or above this threshold go to stderr
309
310
311       --storage-driver-buffer-duration=1m0s
312           Writes  in  the  storage driver will be buffered for this duration,
313       and committed to the non memory backends as a single transaction
314
315
316       --storage-driver-db="cadvisor"
317           database name
318
319
320       --storage-driver-host="localhost:8086"
321           database host:port
322
323
324       --storage-driver-password="root"
325           database password
326
327
328       --storage-driver-secure=false
329           use secure connection with database
330
331
332       --storage-driver-table="stats"
333           table name
334
335
336       --storage-driver-user="root"
337           database username
338
339
340       --token=""
341           Bearer token for authentication to the API server
342
343
344       --user=""
345           The name of the kubeconfig user to use
346
347
348       -v, --v=0
349           log level for V logs
350
351
352       --version=false
353           Print version information and quit
354
355
356       --vmodule=
357           comma-separated list of pattern=N settings for  file-filtered  log‐
358       ging
359
360
361

EXAMPLE

363                # Replace a pod using the data in pod.json.
364                kubectl replace -f ./pod.json
365
366                # Replace a pod based on the JSON passed into stdin.
367                cat pod.json | kubectl replace -f -
368
369                # Update a single-container pod's image version (tag) to v4
370                kubectl get pod mypod -o yaml | sed 's/\(image: myimage\):.*$/\1:v4/' | kubectl replace -f -
371
372                # Force replace, delete and then re-create the resource
373                kubectl replace --force -f ./pod.json
374
375
376
377

SEE ALSO

379       kubectl(1),
380
381
382

HISTORY

384       January  2015,  Originally compiled by Eric Paris (eparis at redhat dot
385       com) based on the kubernetes source material, but hopefully  they  have
386       been automatically generated since!
387
388
389
390Eric Paris                  kubernetes User Manuals              KUBERNETES(1)
Impressum