Merge pull request #26044 from tengqm/zh-resync-deployment

[zh] Resync concepts/workloads/controllers/deployment.md
This commit is contained in:
Kubernetes Prow Robot 2021-01-11 18:06:25 -08:00 committed by GitHub
commit 73c3fc9173
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 35 additions and 18 deletions

View File

@ -5,7 +5,7 @@ feature:
description: >
Kubernetes 会分步骤地将针对应用或其配置的更改上线同时监视应用程序运行状况以确保你不会同时终止所有实例。如果出现问题Kubernetes 会为你回滚所作更改。你应该充分利用不断成长的部署方案生态系统。
content_type: concept
weight: 30
weight: 10
---
<!--
title: Deployments
@ -15,24 +15,24 @@ feature:
Kubernetes progressively rolls out changes to your application or its configuration, while monitoring application health to ensure it doesn't kill all your instances at the same time. If something goes wrong, Kubernetes will rollback the change for you. Take advantage of a growing ecosystem of deployment solutions.
content_type: concept
weight: 30
weight: 10
-->
<!-- overview -->
<!--
A _Deployment_ controller provides declarative updates for [Pods](/docs/concepts/workloads/pods/pod/) and
A _Deployment_ provides declarative updates for [Pods](/docs/concepts/workloads/pods/pod/) and
[ReplicaSets](/docs/concepts/workloads/controllers/replicaset/).
-->
一个 _Deployment_ 控制器为 {{< glossary_tooltip text="Pods" term_id="pod" >}}
一个 _Deployment_ 为 {{< glossary_tooltip text="Pods" term_id="pod" >}}
和 {{< glossary_tooltip term_id="replica-set" text="ReplicaSets" >}}
提供声明式的更新能力。
<!--
You describe a _desired state_ in a Deployment, and the Deployment controller changes the actual state to the desired state at a controlled rate. You can define Deployments to create new ReplicaSets, or to remove existing Deployments and adopt all their resources with new Deployments.
You describe a _desired state_ in a Deployment, and the Deployment {{< glossary_tooltip term_id="controller" >}} changes the actual state to the desired state at a controlled rate. You can define Deployments to create new ReplicaSets, or to remove existing Deployments and adopt all their resources with new Deployments.
-->
你负责描述 Deployment 中的 _目标状态_,而 Deployment 控制器以受控速率更改实际状态,
你负责描述 Deployment 中的 _目标状态_,而 Deployment {{< glossary_tooltip term_id="controller" >}}
以受控速率更改实际状态,
使其变为期望状态。你可以定义 Deployment 以创建新的 ReplicaSet或删除现有 Deployment
并通过新的 Deployment 收养其资源。
@ -196,9 +196,12 @@ Follow the steps given below to create the above Deployment:
请注意期望副本数是根据 `.spec.replicas` 字段设置 3。
<!--
3. To see the Deployment rollout status, run `kubectl rollout status deployment.v1.apps/nginx-deployment`. The output is similar to this:
3. To see the Deployment rollout status, run `kubectl rollout status deployment/nginx-deployment`.
The output is similar to:
-->
3. 要查看 Deployment 上线状态,运行 `kubectl rollout status deployment.v1.apps/nginx-deployment`
3. 要查看 Deployment 上线状态,运行 `kubectl rollout status deployment/nginx-deployment`
输出类似于:
```
@ -341,9 +344,11 @@ is changed, for example if the labels or container images of the template are up
```shell
kubectl --record deployment.apps/nginx-deployment set image \
deployment.v1.apps/nginx-deployment nginx=nginx:1.9.1
deployment.v1.apps/nginx-deployment nginx=nginx:1.16.1
```
<!-- or simply use the following command: -->
<!--
or simply use the following command:
-->
或者使用下面的命令:
```shell
@ -380,7 +385,7 @@ is changed, for example if the labels or container images of the template are up
2. 要查看上线状态,运行:
```shell
kubectl rollout status deployment.v1.apps/nginx-deployment
kubectl rollout status deployment/nginx-deployment
```
<!-- The output is similar to this: -->
@ -655,9 +660,10 @@ Deployment 被触发上线时,系统就会创建 Deployment 的新的修订版
{{< /note >}}
<!--
* Suppose that you made a typo while updating the Deployment, by putting the image name as `nginx:1.91` instead of `nginx:1.9.1`:
* Suppose that you made a typo while updating the Deployment, by putting the image name as `nginx:1.161` instead of `nginx:1.16.1`:
-->
* 假设你在更新 Deployment 时犯了一个拼写错误,将镜像名称命名设置为 `nginx:1.161` 而不是 `nginx:1.16.1`
* 假设你在更新 Deployment 时犯了一个拼写错误,将镜像名称命名设置为
`nginx:1.161` 而不是 `nginx:1.16.1`
```shell
kubectl set image deployment.v1.apps/nginx-deployment nginx=nginx:1.161 --record=true
@ -676,7 +682,7 @@ Deployment 被触发上线时,系统就会创建 Deployment 的新的修订版
* 此上线进程会出现停滞。你可以通过检查上线状态来验证:
```shell
kubectl rollout status deployment.v1.apps/nginx-deployment
kubectl rollout status deployment/nginx-deployment
```
<!-- The output is similar to this: -->
@ -1431,7 +1437,7 @@ successfully, `kubectl rollout status` returns a zero exit code.
如果上线成功完成,`kubectl rollout status` 返回退出代码 0。
```shell
kubectl rollout status deployment.v1.apps/nginx-deployment
kubectl rollout status deployment/nginx-deployment
```
<!-- The output is similar to this: -->
@ -1652,16 +1658,27 @@ returns a non-zero exit code if the Deployment has exceeded the progression dead
如果 Deployment 已超过进度限期,`kubectl rollout status` 返回非零退出代码。
```shell
kubectl rollout status deployment.v1.apps/nginx-deployment
kubectl rollout status deployment/nginx-deployment
```
<!-- The output is similar to this: -->
<!--
The output is similar to this:
-->
输出类似于:
```
Waiting for rollout to finish: 2 out of 3 new replicas have been updated...
error: deployment "nginx" exceeded its progress deadline
```
<!--
and the exit status from `kubectl rollout` is 1 (indicating an error):
-->
`kubectl rollout` 命令的退出状态为 1表明发生了错误
```shell
$ echo $?
```
```
1
```