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

NAME

6       kubectl  patch  -  Update  field(s) of a resource using strategic merge
7       patch
8
9
10

SYNOPSIS

12       kubectl patch [OPTIONS]
13
14
15

DESCRIPTION

17       Update field(s) of a resource using strategic merge patch, a JSON merge
18       patch, or a JSON patch.
19
20
21       JSON and YAML formats are accepted.
22
23
24       Please     refer     to     the     models     in     ⟨https://htmlpre
25       view.github.io/?https://github.com/kubernetes/kuber
26       netes/blob/HEAD/docs/api-reference/v1/definitions.html⟩  to  find  if a
27       field is mutable.
28
29
30

OPTIONS

32       --allow-missing-template-keys=true
33           If true, ignore any errors in templates when a field or map key  is
34       missing  in  the  template.  Only applies to golang and jsonpath output
35       formats.
36
37
38       --dry-run=false
39           If true, only print the object that would be sent, without  sending
40       it.
41
42
43       -f, --filename=[]
44           Filename,  directory,  or  URL to files identifying the resource to
45       update
46
47
48       --local=false
49           If true, patch will operate on the content of  the  file,  not  the
50       server-side resource.
51
52
53       -o, --output=""
54           Output    format.    One   of:   json|yaml|name|go-template|go-tem‐
55       plate-file|template|templatefile|jsonpath|jsonpath-file.
56
57
58       -p, --patch=""
59           The patch to be applied to the resource JSON file.
60
61
62       --record=false
63           Record current kubectl command in the resource annotation.  If  set
64       to  false,  do  not record the command. If set to true, record the com‐
65       mand. If not set, default to updating  the  existing  annotation  value
66       only if one already exists.
67
68
69       -R, --recursive=false
70           Process  the  directory  used in -f, --filename recursively. Useful
71       when you want to manage related manifests  organized  within  the  same
72       directory.
73
74
75       --template=""
76           Template  string  or  path  to template file to use when -o=go-tem‐
77       plate, -o=go-template-file. The template format is golang  templates  [
78http://golang.org/pkg/text/template/#pkg-overview⟩].
79
80
81       --type="strategic"
82           The type of patch being provided; one of [json merge strategic]
83
84
85

OPTIONS INHERITED FROM PARENT COMMANDS

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

SEE ALSO

382       kubectl(1),
383
384
385

HISTORY

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