Merge pull request #51578 from my-git9/npa-30402
[zh-cn]sync scale-intro update-intropull/51624/head^2
commit
d28ad8a344
|
@ -62,9 +62,9 @@ first delete that Service and then run the following command to create a new Ser
|
|||
with its `type` set to `LoadBalancer`:
|
||||
-->
|
||||
如果你是在[上一节](/zh-cn/docs/tutorials/kubernetes-basics/expose/expose-intro/)之后尝试此操作,
|
||||
那么你可能已经删除了你创建的服务或已创建了 `type: NodePort` 类别的 Service。
|
||||
那么你可能已经删除了创建的 Service 或已创建了 `type: NodePort` 类型的 Service。
|
||||
在本节中,假设你已经为 kubernetes-bootcamp Deployment 创建了 `type: LoadBalancer`
|
||||
类别的 Service。
|
||||
类型的 Service。
|
||||
|
||||
如果你**没有**删除在[前一节](/zh-cn/docs/tutorials/kubernetes-basics/expose/expose-intro)中创建的 Service,
|
||||
请先删除该 Service,然后运行以下命令来创建一个新的 `type` 设置为 `LoadBalancer` 的 Service:
|
||||
|
@ -79,19 +79,14 @@ kubectl expose deployment/kubernetes-bootcamp --type="LoadBalancer" --port 8080
|
|||
-->
|
||||
## 扩缩概述
|
||||
|
||||
<!-- animation -->
|
||||
<div class="col-md-8">
|
||||
<div id="myCarousel" class="carousel" data-ride="carousel" data-interval="3000">
|
||||
<div class="carousel-inner" role="listbox">
|
||||
<div class="item carousel-item active">
|
||||
<img src="/docs/tutorials/kubernetes-basics/public/images/module_05_scaling1.svg">
|
||||
</div>
|
||||
<div class="item carousel-item">
|
||||
<img src="/docs/tutorials/kubernetes-basics/public/images/module_05_scaling2.svg">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{< tutorials/carousel id="myCarousel" interval="3000" >}}
|
||||
{{< tutorials/carousel-item
|
||||
image="/docs/tutorials/kubernetes-basics/public/images/module_05_scaling1.svg"
|
||||
active="true" >}}
|
||||
|
||||
{{< tutorials/carousel-item
|
||||
image="/docs/tutorials/kubernetes-basics/public/images/module_05_scaling2.svg" >}}
|
||||
{{< /tutorials/carousel >}}
|
||||
|
||||
{{% alert %}}
|
||||
<!--
|
||||
|
@ -111,7 +106,7 @@ possible, and it will terminate all Pods of the specified Deployment.
|
|||
扩容会将 Pod 数量增加至新的预期状态。
|
||||
Kubernetes 还支持 Pod 的[自动扩缩容](/zh-cn/docs/tasks/run-application/horizontal-pod-autoscale/),
|
||||
但这并不在本教程的讨论范围内。
|
||||
将 Pods 数量收缩到 0 也是可以的,这会终止指定 Deployment 上所有的 Pod。
|
||||
将 Pod 数量收缩到 0 也是可以的,这会终止指定 Deployment 上所有的 Pod。
|
||||
|
||||
<!--
|
||||
Running multiple instances of an application will require a way to distribute the
|
||||
|
@ -182,22 +177,22 @@ Notice that the name of the ReplicaSet is always formatted as
|
|||
The random string is randomly generated and uses the pod-template-hash as a seed.
|
||||
|
||||
Two important columns of this output are:
|
||||
-->
|
||||
注意 ReplicaSet 名称总是遵循 <nobr>[DEPLOYMENT-NAME]-[RANDOM-STRING]</nobr> 的格式。
|
||||
随机字符串是使用 `pod-template-hash` 作为种子随机生成的。
|
||||
|
||||
两个重要的列是:
|
||||
<!--
|
||||
* _DESIRED_ displays the desired number of replicas of the application, which you
|
||||
define when you create the Deployment. This is the desired state.
|
||||
* _CURRENT_ displays how many replicas are currently running.
|
||||
Next, let’s scale the Deployment to 4 replicas. We’ll use the `kubectl scale` command,
|
||||
followed by the Deployment type, name and desired number of instances:
|
||||
-->
|
||||
注意 ReplicaSet 名称总是遵循 <nobr>[DEPLOYMENT-NAME]-[RANDOM-STRING]</nobr> 的格式。
|
||||
随机字符串是使用 `pod-template-hash` 作为种子随机生成的。
|
||||
|
||||
两个重要的列是:
|
||||
|
||||
* **DESIRED** 显示期望应用具有的副本数量,在你创建 Deployment 时要定义这个值。这是期望的状态。
|
||||
* **CURRENT** 显示当前正在运行的副本数量。
|
||||
|
||||
接下来,让我们扩容 Deployment 到 4 个副本。
|
||||
接下来,让我们将 Deployment 扩容到 4 个副本。
|
||||
我们将使用 `kubectl scale` 命令,后面给出 Deployment 类别、名称和预期的实例数量:
|
||||
|
||||
```shell
|
||||
|
@ -341,7 +336,7 @@ kubectl scale deployments/kubernetes-bootcamp --replicas=2
|
|||
<!--
|
||||
List the Deployments to check if the change was applied with the `get deployments` subcommand:
|
||||
-->
|
||||
要检查更改是否已应用,可使用 `get deployments` 子命令
|
||||
要检查更改是否已应用,可使用 `get deployments` 子命令:
|
||||
|
||||
```shell
|
||||
kubectl get deployments
|
||||
|
@ -370,5 +365,5 @@ This confirms that 2 Pods were terminated.
|
|||
* Learn more about [Autoscaling](/docs/concepts/workloads/autoscaling/).
|
||||
-->
|
||||
* [滚动更新](/zh-cn/docs/tutorials/kubernetes-basics/update/update-intro/)教程。
|
||||
* 了解更多关于[ReplicaSet](/zh-cn/docs/concepts/workloads/controllers/replicaset/)。
|
||||
* 了解更多关于 [ReplicaSet](/zh-cn/docs/concepts/workloads/controllers/replicaset/)。
|
||||
* 了解更多关于[自动伸缩](/zh-cn/docs/concepts/workloads/autoscaling/)。
|
||||
|
|
|
@ -37,7 +37,7 @@ The new Pods are scheduled on Nodes with available resources, and Kubernetes wai
|
|||
for those new Pods to start before removing the old Pods.
|
||||
-->
|
||||
用户希望应用程序始终可用,而开发人员则需要每天多次部署它们的新版本。
|
||||
在 Kubernetes 中,这些是通过滚动更新(Rolling Updates)完成的。
|
||||
在 Kubernetes 中,这些是通过滚动更新(Rolling Update)完成的。
|
||||
**滚动更新**允许通过使用新的实例逐步更新 Pod 实例,实现零停机的 Deployment 更新。
|
||||
新的 Pod 将被调度到具有可用资源的节点上。
|
||||
|
||||
|
@ -54,27 +54,25 @@ versioned and any Deployment update can be reverted to a previous (stable) versi
|
|||
这两个选项都可以配置为(Pod)数字或百分比。
|
||||
在 Kubernetes 中,更新是具有版本控制的,任何 Deployment 更新都可以恢复到以前的(稳定)版本。
|
||||
|
||||
<!--
|
||||
## Rolling updates overview
|
||||
-->
|
||||
## 滚动更新概述
|
||||
|
||||
<!-- animation -->
|
||||
<div class="col-md-8">
|
||||
<div id="myCarousel" class="carousel" data-ride="carousel" data-interval="3000">
|
||||
<div class="carousel-inner" role="listbox">
|
||||
<div class="item carousel-item active">
|
||||
<img src="/docs/tutorials/kubernetes-basics/public/images/module_06_rollingupdates1.svg">
|
||||
</div>
|
||||
<div class="item carousel-item">
|
||||
<img src="/docs/tutorials/kubernetes-basics/public/images/module_06_rollingupdates2.svg">
|
||||
</div>
|
||||
<div class="item carousel-item">
|
||||
<img src="/docs/tutorials/kubernetes-basics/public/images/module_06_rollingupdates3.svg">
|
||||
</div>
|
||||
<div class="item carousel-item">
|
||||
<img src="/docs/tutorials/kubernetes-basics/public/images/module_06_rollingupdates4.svg">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{< tutorials/carousel id="myCarousel" interval="3000" >}}
|
||||
{{< tutorials/carousel-item
|
||||
image="/docs/tutorials/kubernetes-basics/public/images/module_06_rollingupdates1.svg"
|
||||
active="true" >}}
|
||||
|
||||
{{< tutorials/carousel-item
|
||||
image="/docs/tutorials/kubernetes-basics/public/images/module_06_rollingupdates2.svg" >}}
|
||||
|
||||
{{< tutorials/carousel-item
|
||||
image="/docs/tutorials/kubernetes-basics/public/images/module_06_rollingupdates3.svg" >}}
|
||||
|
||||
{{< tutorials/carousel-item
|
||||
image="/docs/tutorials/kubernetes-basics/public/images/module_06_rollingupdates4.svg" >}}
|
||||
{{< /tutorials/carousel >}}
|
||||
|
||||
{{% alert %}}
|
||||
<!--
|
||||
|
@ -91,7 +89,13 @@ will load-balance the traffic only to available Pods during the update. An avail
|
|||
Pod is an instance that is available to the users of the application.
|
||||
|
||||
Rolling updates allow the following actions:
|
||||
-->
|
||||
与应用程序规模扩缩类似,如果 Deployment 的访问是公开的,Service
|
||||
在更新期间仅将流量负载均衡到可用的 Pod。可用的 Pod 是指对应用的用户可用的实例。
|
||||
|
||||
滚动更新允许以下操作:
|
||||
|
||||
<!--
|
||||
* Promote an application from one environment to another (via container image updates)
|
||||
* Rollback to previous versions
|
||||
* Continuous Integration and Continuous Delivery of applications with zero downtime
|
||||
|
@ -99,11 +103,6 @@ Rolling updates allow the following actions:
|
|||
In the following interactive tutorial, we'll update our application to a new version,
|
||||
and also perform a rollback.
|
||||
-->
|
||||
与应用程序规模扩缩类似,如果 Deployment 的访问是公开的,Service
|
||||
在更新期间仅将流量负载均衡到可用的 Pod。可用的 Pod 是指对应用的用户可用的实例。
|
||||
|
||||
滚动更新允许以下操作:
|
||||
|
||||
* 将应用程序从一个环境升级到另一个环境(通过容器镜像更新)
|
||||
* 回滚到以前的版本
|
||||
* 持续集成和持续交付应用程序,无需停机
|
||||
|
@ -175,8 +174,8 @@ you can create it again with:
|
|||
-->
|
||||
### 验证更新
|
||||
|
||||
首先,检查服务是否正在运行,因为你可能在上一个教程步骤中删除了它。
|
||||
运行 `describe services/kubernetes-bootcamp`,如果服务缺失,
|
||||
首先,检查 Service 是否正在运行,因为你可能在上一个教程步骤中删除了它。
|
||||
运行 `describe services/kubernetes-bootcamp`,如果 Service 缺失,
|
||||
你可以使用以下命令重新创建:
|
||||
|
||||
```shell
|
||||
|
@ -259,8 +258,7 @@ kubectl get deployments
|
|||
Notice that the output doesn't list the desired number of available Pods. Run the
|
||||
`get pods` subcommand to list all Pods:
|
||||
-->
|
||||
注意输出中不会列出期望的可用 Pod 数。运行 `get pods`
|
||||
子命令来列出所有 Pod:
|
||||
注意输出中不会列出期望的可用 Pod 数。运行 `get pods` 子命令来列出所有 Pod:
|
||||
|
||||
```shell
|
||||
kubectl get pods
|
||||
|
@ -304,7 +302,7 @@ Use the `get pods` subcommand to list the Pods again:
|
|||
`rollout undo` 命令会恢复 Deployment 到先前的已知状态(`v2` 的镜像)。
|
||||
更新是有版本控制的,你可以恢复 Deployment 到任何先前已知状态。
|
||||
|
||||
使用 `get pods` 子命令再次列举 Pod:
|
||||
使用 `get pods` 子命令再次列出 Pod:
|
||||
|
||||
```shell
|
||||
kubectl get pods
|
||||
|
|
Loading…
Reference in New Issue