Skip to content

Commit b0beb9a

Browse files
authored
Merge pull request #32240 from my-git9/patch-58
[zh] Update update-api-object-kubectl-patch.md
2 parents 431c32f + 8935aeb commit b0beb9a

File tree

1 file changed

+10
-23
lines changed

1 file changed

+10
-23
lines changed

content/zh/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch.md

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ Patch your Deployment:
254254
对 Deployment 执行 patch 操作:
255255
256256
```
257-
kubectl patch deployment patch-demo --patch "$(cat patch-file-containers.yaml)"
257+
kubectl patch deployment patch-demo --patch-file patch-file-tolerations.yaml"
258258
```
259259
260260
<!--
@@ -368,7 +368,7 @@ In your patch command, set `type` to `merge`:
368368
在 patch 命令中,将 `type` 设置为 `merge`
369369
370370
```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
372372
```
373373
374374
<!--
@@ -450,14 +450,9 @@ spec:
450450
<!-- Patch your Deployment: -->
451451
修补你的 Deployment:
452452
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+
```
461456
462457
<!--
463458
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:
497492
498493
使用新的 patch 重新修补 Deployment:
499494
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+
```
508498
509499
<!-- Examine the content of the Deployment: -->
510500
检查 Deployment 的内容:
@@ -625,10 +615,10 @@ The following commands are equivalent:
625615
以下命令是等价的:
626616
627617
```shell
628-
kubectl patch deployment patch-demo --patch "$(cat patch-file.yaml)"
618+
kubectl patch deployment patch-demo --patch-file patch-file.yaml"
629619
kubectl patch deployment patch-demo --patch 'spec:\n template:\n spec:\n containers:\n - name: patch-demo-ctr-2\n image: redis'
630620
631-
kubectl patch deployment patch-demo --patch "$(cat patch-file.json)"
621+
kubectl patch deployment patch-demo --patch-file patch-file.json"
632622
kubectl patch deployment patch-demo --patch '{"spec": {"template": {"spec": {"containers": [{"name": "patch-demo-ctr-2","image": "redis"}]}}}}'
633623
```
634624
@@ -681,6 +671,3 @@ Strategic merge patch is not supported for custom resources.
681671
* [使用配置文件执行 Kubernetes 对象的指令式管理](/zh/docs/tasks/manage-kubernetes-objects/imperative-config)
682672
* [使用配置文件对 Kubernetes 对象进行声明式管理](/zh/docs/tasks/manage-kubernetes-objects/declarative-config/)
683673
684-
685-
686-

0 commit comments

Comments
 (0)