@@ -254,7 +254,7 @@ Patch your Deployment:
254
254
对 Deployment 执行 patch 操作:
255
255
256
256
```
257
- kubectl patch deployment patch-demo --patch " $(cat patch-file-containers .yaml ) "
257
+ kubectl patch deployment patch-demo --patch-file patch-file-tolerations .yaml"
258
258
` ` `
259
259
260
260
<!--
@@ -368,7 +368,7 @@ In your patch command, set `type` to `merge`:
368
368
在 patch 命令中,将 ` type ` 设置为 ` merge` :
369
369
370
370
` ` ` shell
371
- kubectl patch deployment patch-demo --type merge --patch "$(cat patch-file-2.yaml)"
371
+ kubectl patch deployment patch-demo --type merge --patch-file patch-file-2. yaml
372
372
` ` `
373
373
374
374
<!--
@@ -450,14 +450,9 @@ spec:
450
450
<!-- Patch your Deployment: -->
451
451
修补你的 Deployment:
452
452
453
- {{< tabs name="kubectl_retainkeys_example" >}}
454
- {{{< tab name="Bash" codelang="bash" >}}
455
- kubectl patch deployment retainkeys-demo --type merge --patch "$(cat patch-file-no-retainkeys.yaml)"
456
- {{< /tab >}}
457
- {{< tab name="PowerShell" codelang="posh" >}}
458
- kubectl patch deployment retainkeys-demo --type merge --patch $(Get-Content patch-file-no-retainkeys.yaml -Raw)
459
- {{< /tab >}}}
460
- {{< /tabs >}}
453
+ ` ` ` shell
454
+ kubectl patch deployment patch-demo --patch-file patch-file.yaml
455
+ ` ` `
461
456
462
457
<!--
463
458
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 ` :
@@ -497,14 +492,9 @@ Patch your Deployment again with this new patch:
497
492
498
493
使用新的 patch 重新修补 Deployment:
499
494
500
- {{< tabs name="kubectl_retainkeys2_example" >}}
501
- {{{< tab name="Bash" codelang="bash" >}}
502
- kubectl patch deployment retainkeys-demo --type merge --patch "$(cat patch-file-retainkeys.yaml)"
503
- {{< /tab >}}
504
- {{< tab name="PowerShell" codelang="posh" >}}
505
- kubectl patch deployment retainkeys-demo --type merge --patch $(Get-Content patch-file-retainkeys.yaml -Raw)
506
- {{< /tab >}}}
507
- {{< /tabs >}}
495
+ ` ` ` shell
496
+ kubectl patch deployment retainkeys-demo --type merge --patch-file patch-file-no-retainkeys.yaml
497
+ ` ` `
508
498
509
499
<!-- Examine the content of the Deployment: -->
510
500
检查 Deployment 的内容:
@@ -625,10 +615,10 @@ The following commands are equivalent:
625
615
以下命令是等价的:
626
616
627
617
` ` ` shell
628
- kubectl patch deployment patch-demo --patch "$(cat patch-file.yaml) "
618
+ kubectl patch deployment patch-demo --patch-file patch-file.yaml "
629
619
kubectl patch deployment patch-demo --patch 'spec:\n template:\n spec:\n containers:\n - name: patch-demo-ctr-2\n image: redis'
630
620
631
- kubectl patch deployment patch-demo --patch "$(cat patch-file.json) "
621
+ kubectl patch deployment patch-demo --patch-file patch-file.json"
632
622
kubectl patch deployment patch-demo --patch ' {"spec": {"template": {"spec": {"containers": [{"name": "patch-demo-ctr-2","image": "redis"}]}}}}'
633
623
` ` `
634
624
@@ -681,6 +671,3 @@ Strategic merge patch is not supported for custom resources.
681
671
* [使用配置文件执行 Kubernetes 对象的指令式管理](/zh/docs/tasks/manage-kubernetes-objects/imperative-config)
682
672
* [使用配置文件对 Kubernetes 对象进行声明式管理](/zh/docs/tasks/manage-kubernetes-objects/declarative-config/)
683
673
684
-
685
-
686
-
0 commit comments