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

NAME

9       kubectl replace - Replace a resource by file name or stdin
10
11
12

SYNOPSIS

14       kubectl replace [OPTIONS]
15
16
17

DESCRIPTION

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

OPTIONS

31       --allow-missing-template-keys=true      If true, ignore any  errors  in
32       templates  when a field or map key is missing in the template. Only ap‐
33       plies to golang and jsonpath output formats.
34
35
36       --cascade="background"      Must be "background", "orphan",  or  "fore‐
37       ground".  Selects  the  deletion  cascading strategy for the dependents
38       (e.g. Pods created by a ReplicationController). Defaults to background.
39
40
41       --dry-run="none"      Must be "none", "server", or "client". If  client
42       strategy, only print the object that would be sent, without sending it.
43       If server strategy, submit server-side request without  persisting  the
44       resource.
45
46
47       --field-manager="kubectl-replace"       Name  of  the  manager  used to
48       track field ownership.
49
50
51       -f, --filename=[]      to use to replace the resource.
52
53
54       --force=false      If true, immediately remove resources from  API  and
55       bypass  graceful  deletion.  Note  that  immediate deletion of some re‐
56       sources may result in inconsistency or data loss and requires confirma‐
57       tion.
58
59
60       --grace-period=-1       Period of time in seconds given to the resource
61       to terminate gracefully. Ignored if negative. Set to  1  for  immediate
62       shutdown. Can only be set to 0 when --force is true (force deletion).
63
64
65       -k,  --kustomize=""       Process  a kustomization directory. This flag
66       can't be used together with -f or -R.
67
68
69       -o, --output=""      Output format. One of: (json, yaml, name,  go-tem‐
70       plate, go-template-file, template, templatefile, jsonpath, jsonpath-as-
71       json, jsonpath-file).
72
73
74       --raw=""      Raw URI to PUT to the server.  Uses the transport  speci‐
75       fied by the kubeconfig file.
76
77
78       -R, --recursive=false      Process the directory used in -f, --filename
79       recursively. Useful when you want to manage related manifests organized
80       within the same directory.
81
82
83       --save-config=false       If  true, the configuration of current object
84       will be saved in its annotation. Otherwise, the annotation will be  un‐
85       changed.  This flag is useful when you want to perform kubectl apply on
86       this object in the future.
87
88
89       --show-managed-fields=false      If true, keep the  managedFields  when
90       printing objects in JSON or YAML format.
91
92
93       --subresource=""       If specified, replace will operate on the subre‐
94       source of the requested object. Must be one  of  [status  scale].  This
95       flag is alpha and may change in the future.
96
97
98       --template=""      Template string or path to template file to use when
99       -o=go-template, -o=go-template-file. The template format is golang tem‐
100       plates [http://golang.org/pkg/text/template/#pkg-overview].
101
102
103       --timeout=0s       The  length  of  time  to wait before giving up on a
104       delete, zero means determine a timeout from the size of the object
105
106
107       --validate="strict"      Must be one of: strict (or true), warn, ignore
108       (or false).            "true" or "strict" will use a schema to validate
109       the input and fail the request if invalid. It will perform server  side
110       validation  if  ServerSideFieldValidation is enabled on the api-server,
111       but will fall back to less  reliable  client-side  validation  if  not.
112                 "warn"  will  warn  about unknown or duplicate fields without
113       blocking the request if server-side field validation is enabled on  the
114       API  server,  and  behave  as "ignore" otherwise.            "false" or
115       "ignore" will not perform any schema validation, silently dropping  any
116       unknown or duplicate fields.
117
118
119       --wait=false      If true, wait for resources to be gone before return‐
120       ing. This waits for finalizers.
121
122
123

OPTIONS INHERITED FROM PARENT COMMANDS

125       --as=""      Username to impersonate for the operation. User could be a
126       regular user or a service account in a namespace.
127
128
129       --as-group=[]       Group  to  impersonate for the operation, this flag
130       can be repeated to specify multiple groups.
131
132
133       --as-uid=""      UID to impersonate for the operation.
134
135
136       --azure-container-registry-config=""      Path to the  file  containing
137       Azure container registry configuration information.
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       --cluster=""      The name of the kubeconfig cluster to use
154
155
156       --context=""      The name of the kubeconfig context to use
157
158
159       --insecure-skip-tls-verify=false      If true, the server's certificate
160       will not be checked for validity. This will make your HTTPS connections
161       insecure
162
163
164       --kubeconfig=""      Path to the kubeconfig file to  use  for  CLI  re‐
165       quests.
166
167
168       --match-server-version=false        Require  server  version  to  match
169       client version
170
171
172       -n, --namespace=""      If present, the namespace scope  for  this  CLI
173       request
174
175
176       --password=""      Password for basic authentication to the API server
177
178
179       --profile="none"         Name   of   profile   to   capture.   One   of
180       (none|cpu|heap|goroutine|threadcreate|block|mutex)
181
182
183       --profile-output="profile.pprof"      Name of the  file  to  write  the
184       profile to
185
186
187       --request-timeout="0"       The length of time to wait before giving up
188       on a single server request. Non-zero values  should  contain  a  corre‐
189       sponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't time‐
190       out requests.
191
192
193       -s, --server=""      The address and port of the Kubernetes API server
194
195
196       --tls-server-name=""      Server name to  use  for  server  certificate
197       validation.  If  it  is  not provided, the hostname used to contact the
198       server is used
199
200
201       --token=""      Bearer token for authentication to the API server
202
203
204       --user=""      The name of the kubeconfig user to use
205
206
207       --username=""      Username for basic authentication to the API server
208
209
210       --version=false      Print version information and quit
211
212
213       --warnings-as-errors=false      Treat warnings received from the server
214       as errors and exit with a non-zero exit code
215
216
217

EXAMPLE

219                # Replace a pod using the data in pod.json
220                kubectl replace -f ./pod.json
221
222                # Replace a pod based on the JSON passed into stdin
223                cat pod.json | kubectl replace -f -
224
225                # Update a single-container pod's image version (tag) to v4
226                kubectl get pod mypod -o yaml | sed 's/\(image: myimage\):.*$/\1:v4/' | kubectl replace -f -
227
228                # Force replace, delete and then re-create the resource
229                kubectl replace --force -f ./pod.json
230
231
232
233

SEE ALSO

235       kubectl(1),
236
237
238

HISTORY

240       January  2015,  Originally compiled by Eric Paris (eparis at redhat dot
241       com) based on the kubernetes source material, but hopefully  they  have
242       been automatically generated since!
243
244
245
246Manuals                              User            KUBERNETES(1)(kubernetes)
Impressum