70
70
71
71
Patch your Deployment:
72
72
73
- {{< tabs name="kubectl_patch_example" >}}
74
- {{{< tab name="Bash" codelang="bash" >}}
75
- kubectl patch deployment patch-demo --patch "$(cat patch-file.yaml)"
76
- {{< /tab >}}
77
- {{< tab name="PowerShell" codelang="posh" >}}
78
- kubectl patch deployment patch-demo --patch $(Get-Content patch-file.yaml -Raw)
79
- {{< /tab >}}}
80
- {{< /tabs >}}
73
+ ` ` ` shell
74
+ kubectl patch deployment patch-demo --patch-file patch-file.yaml
75
+ ```
81
76
82
77
View the patched Deployment:
83
78
@@ -183,7 +178,7 @@ spec:
183
178
Patch your Deployment:
184
179
185
180
```shell
186
- kubectl patch deployment patch-demo --patch " $(cat patch-file-tolerations.yaml ) "
181
+ kubectl patch deployment patch-demo --patch-file patch-file-tolerations.yaml
187
182
```
188
183
189
184
View the patched Deployment:
@@ -249,7 +244,7 @@ spec:
249
244
In your patch command, set ` type` to ` merge` :
250
245
251
246
` ` ` shell
252
- kubectl patch deployment patch-demo --type merge --patch "$(cat patch-file-2.yaml)"
247
+ kubectl patch deployment patch-demo --type merge --patch-file patch-file-2.yaml
253
248
` ` `
254
249
255
250
View the patched Deployment:
@@ -308,14 +303,9 @@ spec:
308
303
309
304
Patch your Deployment:
310
305
311
- {{< tabs name="kubectl_retainkeys_example" >}}
312
- {{{< tab name="Bash" codelang="bash" >}}
313
- kubectl patch deployment retainkeys-demo --type merge --patch "$(cat patch-file-no-retainkeys.yaml)"
314
- {{< /tab >}}
315
- {{< tab name="PowerShell" codelang="posh" >}}
316
- kubectl patch deployment retainkeys-demo --type merge --patch $(Get-Content patch-file-no-retainkeys.yaml -Raw)
317
- {{< /tab >}}}
318
- {{< /tabs >}}
306
+ ```shell
307
+ kubectl patch deployment retainkeys-demo --type merge --patch-file patch-file-no-retainkeys.yaml
308
+ ```
319
309
320
310
In the output, you can see that it is not possible to set `type` as `Recreate` when a value is defined for `spec.strategy.rollingUpdate`:
321
311
@@ -339,14 +329,9 @@ With this patch, we indicate that we want to retain only the `type` key of the `
339
329
340
330
Patch your Deployment again with this new patch:
341
331
342
- {{< tabs name="kubectl_retainkeys2_example" >}}
343
- {{{< tab name="Bash" codelang="bash" >}}
344
- kubectl patch deployment retainkeys-demo --type merge --patch "$(cat patch-file-retainkeys.yaml)"
345
- {{< /tab >}}
346
- {{< tab name="PowerShell" codelang="posh" >}}
347
- kubectl patch deployment retainkeys-demo --type merge --patch $(Get-Content patch-file-retainkeys.yaml -Raw)
348
- {{< /tab >}}}
349
- {{< /tabs >}}
332
+ ```shell
333
+ kubectl patch deployment retainkeys-demo --type merge --patch-file patch-file-retainkeys.yaml
334
+ ```
350
335
351
336
Examine the content of the Deployment:
352
337
@@ -425,10 +410,10 @@ The following commands are equivalent:
425
410
426
411
427
412
```shell
428
- kubectl patch deployment patch-demo --patch "$(cat patch-file.yaml)"
413
+ kubectl patch deployment patch-demo --patch-file patch-file.yaml
429
414
kubectl patch deployment patch-demo --patch ' spec:\n template:\n spec:\n containers:\n - name: patch-demo-ctr-2 \n image: redis'
430
415
431
- kubectl patch deployment patch-demo --patch "$(cat patch-file.json)"
416
+ kubectl patch deployment patch-demo --patch-file patch-file.json
432
417
kubectl patch deployment patch-demo --patch ' {" spec" : {" template" : {" spec" : {" containers" : [{" name" : " patch-demo-ctr-2" ," image" : " redis" }]}}}}'
433
418
```
434
419
0 commit comments