Skip to content

Commit bf9b40f

Browse files
authored
Merge pull request #38796 from Zhuzhenghao/fix/manage-deployment
[zh-cn] sync manage-deployment.md with en page
2 parents 40b4631 + b24668e commit bf9b40f

File tree

1 file changed

+35
-17
lines changed

1 file changed

+35
-17
lines changed

content/zh-cn/docs/concepts/cluster-administration/manage-deployment.md

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Kubernetes 提供了一些工具来帮助管理你的应用部署,包括扩缩
2727
<!--
2828
## Organizing resource configurations
2929
30-
Many applications require multiple resources to be created, such as a Deployment and a Service. Management of multiple resources can be simplified by grouping them together in the same file (separated by in YAML). For example:
30+
Many applications require multiple resources to be created, such as a Deployment and a Service. Management of multiple resources can be simplified by grouping them together in the same file (separated by `---` in YAML). For example:
3131
-->
3232
## 组织资源配置 {#organizing-resource-config}
3333

@@ -68,15 +68,15 @@ kubectl apply -f https://k8s.io/examples/application/nginx/nginx-svc.yaml -f htt
6868
```
6969

7070
<!--
71-
It is a recommended practice to put resources related to the same microservice or application tier into the same file, and to group all of the files associated with your application in the same directory. If the tiers of your application bind to each other using DNS, then you can deploy all of the components of your stack together.
71+
It is a recommended practice to put resources related to the same microservice or application tier into the same file, and to group all of the files associated with your application in the same directory. If the tiers of your application bind to each other using DNS, you can deploy all of the components of your stack together.
7272
73-
A URL can also be specified as a configuration source, which is handy for deploying directly from configuration files checked into Github:
73+
A URL can also be specified as a configuration source, which is handy for deploying directly from configuration files checked into GitHub:
7474
-->
7575
建议的做法是,将同一个微服务或同一应用层相关的资源放到同一个文件中,
7676
将同一个应用相关的所有文件按组存放到同一个目录中。
77-
如果应用的各层使用 DNS 相互绑定,那么你可以将堆栈的所有组件一起部署
77+
如果应用的各层使用 DNS 相互绑定,你可以将堆栈的所有组件一起部署
7878

79-
还可以使用 URL 作为配置源,便于直接使用已经提交到 Github 上的配置文件进行部署:
79+
还可以使用 URL 作为配置源,便于直接使用已经提交到 GitHub 上的配置文件进行部署:
8080

8181
```shell
8282
kubectl apply -f https://raw.githubusercontent.com/kubernetes/website/main/content/zh-cn/examples/application/nginx/nginx-deployment.yaml
@@ -107,9 +107,9 @@ service "my-nginx-svc" deleted
107107
```
108108

109109
<!--
110-
In the case of two resources, it's also easy to specify both on the command line using the resource/name syntax:
110+
In the case of two resources, you can specify both resources on the command line using the resource/name syntax:
111111
-->
112-
在仅有两种资源的情况下,可以使用"资源类型/资源名"的语法在命令行中
112+
在仅有两种资源的情况下,你可以使用"资源类型/资源名"的语法在命令行中
113113
同时指定这两个资源:
114114

115115
```shell
@@ -162,10 +162,10 @@ If you happen to organize your resources across several subdirectories within a
162162
执行操作,方法是在 `--filename,-f` 后面指定 `--recursive` 或者 `-R`
163163

164164
<!--
165-
For instance, assume there is a directory `project/k8s/development` that holds all of the manifests needed for the development environment, organized by resource type:
165+
For instance, assume there is a directory `project/k8s/development` that holds all of the {{< glossary_tooltip text="manifests" term_id="manifest" >}} needed for the development environment, organized by resource type:
166166
-->
167167
例如,假设有一个目录路径为 `project/k8s/development`,它保存开发环境所需的
168-
所有清单,并按资源类型组织:
168+
所有{{< glossary_tooltip text="清单" term_id="manifest" >}},并按资源类型组织:
169169

170170
```
171171
project/k8s/development
@@ -208,7 +208,7 @@ persistentvolumeclaim/my-pvc created
208208
```
209209

210210
<!--
211-
The `--recursive` flag works with any operation that accepts the `--filename,-f` flag such as: `kubectl {create,get,delete,describe,rollout} etc.`
211+
The `--recursive` flag works with any operation that accepts the `--filename,-f` flag such as: `kubectl {create,get,delete,describe,rollout}` etc.
212212
213213
The `--recursive` flag also works when multiple `-f` arguments are provided:
214214
-->
@@ -270,7 +270,9 @@ Redis 的主节点和从节点会有不同的 `tier` 标签,甚至还有一个
270270
role: master
271271
```
272272

273-
<!-- and -->
273+
<!--
274+
and
275+
-->
274276
以及
275277

276278
```yaml
@@ -457,7 +459,8 @@ Sometimes you would want to attach annotations to resources. Annotations are arb
457459
kubectl annotate pods my-nginx-v4-9gw19 description='my frontend running nginx'
458460
kubectl get pods my-nginx-v4-9gw19 -o yaml
459461
```
460-
```shell
462+
463+
```
461464
apiVersion: v1
462465
kind: pod
463466
metadata:
@@ -477,7 +480,7 @@ For more information, please see [annotations](/docs/concepts/overview/working-w
477480
<!--
478481
## Scaling your application
479482
480-
When load on your application grows or shrinks, use `kubectl` to scale you application. For instance, to decrease the number of nginx replicas from 3 to 1, do:
483+
When load on your application grows or shrinks, use `kubectl` to scale your application. For instance, to decrease the number of nginx replicas from 3 to 1, do:
481484
-->
482485
## 扩缩你的应用 {#scaling-your-app}
483486

@@ -543,7 +546,8 @@ Sometimes it's necessary to make narrow, non-disruptive updates to resources you
543546
### kubectl apply
544547

545548
<!--
546-
It is suggested to maintain a set of configuration files in source control (see [configuration as code](http://martinfowler.com/bliki/InfrastructureAsCode.html)),
549+
It is suggested to maintain a set of configuration files in source control
550+
(see [configuration as code](https://martinfowler.com/bliki/InfrastructureAsCode.html)),
547551
so that they can be maintained and versioned along with the code for the resources they configure.
548552
Then, you can use [`kubectl apply`](/docs/reference/generated/kubectl/kubectl-commands/#apply) to push your configuration changes to the cluster.
549553
-->
@@ -697,7 +701,21 @@ deployment.apps/my-nginx created
697701
```
698702

699703
<!--
700-
To update to version 1.16.1, change `.spec.template.spec.containers[0].image` from `nginx:1.14.2` to `nginx:1.16.1`, with the previous kubectl commands.
704+
with 3 replicas (so the old and new revisions can coexist):
705+
-->
706+
707+
运行 3 个副本(这样新旧版本可以同时存在)
708+
709+
```shell
710+
kubectl scale deployment my-nginx --current-replicas=1 --replicas=3
711+
```
712+
713+
```
714+
deployment.apps/my-nginx scaled
715+
```
716+
717+
<!--
718+
To update to version 1.16.1, change `.spec.template.spec.containers[0].image` from `nginx:1.14.2` to `nginx:1.16.1` using the previous kubectl commands.
701719
-->
702720
要更新到 1.16.1 版本,只需使用我们前面学到的 kubectl 命令将
703721
`.spec.template.spec.containers[0].image``nginx:1.14.2` 修改为 `nginx:1.16.1`
@@ -716,8 +734,8 @@ That's it! The Deployment will declaratively update the deployed nginx applicati
716734
## {{% heading "whatsnext" %}}
717735

718736
<!--
719-
- [Learn about how to use `kubectl` for application introspection and debugging.](/docs/tasks/debug/debug-application/debug-running-pod/)
720-
- [Configuration Best Practices and Tips](/docs/concepts/configuration/overview/)
737+
- Learn about [how to use `kubectl` for application introspection and debugging](/docs/tasks/debug/debug-application/debug-running-pod/).
738+
- See [Configuration Best Practices and Tips](/docs/concepts/configuration/overview/).
721739
-->
722740
- 学习[如何使用 `kubectl` 观察和调试应用](/zh-cn/docs/tasks/debug/debug-application/debug-running-pod/)
723741
- 阅读[配置最佳实践和技巧](/zh-cn/docs/concepts/configuration/overview/)

0 commit comments

Comments
 (0)