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