Skip to content

Commit e49d48e

Browse files
committed
[zh]Sync replicationcontroller.md
1 parent 70d3156 commit e49d48e

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

content/zh-cn/docs/concepts/workloads/controllers/replicationcontroller.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ A _ReplicationController_ ensures that a specified number of pod replicas are ru
3939
time. In other words, a ReplicationController makes sure that a pod or a homogeneous set of pods is
4040
always up and available.
4141
-->
42-
_ReplicationController_ 确保在任何时候都有特定数量的 Pod 副本处于运行状态。
42+
**ReplicationController** 确保在任何时候都有特定数量的 Pod 副本处于运行状态。
4343
换句话说,ReplicationController 确保一个 Pod 或一组同类的 Pod 总是可用的。
4444

4545
<!-- body -->
@@ -195,12 +195,11 @@ A ReplicationController also needs a [`.spec` section](https://git.k8s.io/commun
195195
-->
196196
## 编写一个 ReplicationController 规约 {#writing-a-replicationcontroller-spec}
197197

198-
与所有其它 Kubernetes 配置一样,ReplicationController 需要 `apiVersion`
199-
`kind``metadata` 字段。
198+
与所有其它 Kubernetes 配置一样,ReplicationController 需要 `apiVersion``kind``metadata` 字段。
200199
ReplicationController 对象的名称必须是有效的
201200
[DNS 子域名](/zh-cn/docs/concepts/overview/working-with-objects/names#dns-subdomain-names)
202-
有关使用配置文件的常规信息,参考
203-
[对象管理](/zh-cn/docs/concepts/overview/working-with-objects/object-management/)
201+
有关使用配置文件的常规信息,
202+
参考[对象管理](/zh-cn/docs/concepts/overview/working-with-objects/object-management/)
204203

205204
ReplicationController 也需要一个 [`.spec` 部分](https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status)
206205

@@ -225,15 +224,16 @@ labels and an appropriate restart policy. For labels, make sure not to overlap w
225224
Only a [`.spec.template.spec.restartPolicy`](/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy) equal to `Always` is allowed, which is the default if not specified.
226225
227226
For local container restarts, ReplicationControllers delegate to an agent on the node,
228-
for example the [Kubelet](/docs/reference/command-line-tools-reference/kubelet/) or Docker.
227+
for example the [Kubelet](/docs/reference/command-line-tools-reference/kubelet/).
229228
-->
230229
除了 Pod 所需的字段外,ReplicationController 中的 Pod 模板必须指定适当的标签和适当的重新启动策略。
231230
对于标签,请确保不与其他控制器重叠。参考 [Pod 选择算符](#pod-selector)
232231

233-
只允许 [`.spec.template.spec.restartPolicy`](/zh-cn/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy) 等于 `Always`,如果没有指定,这是默认值。
232+
只允许 [`.spec.template.spec.restartPolicy`](/zh-cn/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy)
233+
等于 `Always`,如果没有指定,这是默认值。
234234

235235
对于本地容器重启,ReplicationController 委托给节点上的代理,
236-
例如 [Kubelet](/zh-cn/docs/reference/command-line-tools-reference/kubelet/) 或 Docker
236+
例如 [Kubelet](/zh-cn/docs/reference/command-line-tools-reference/kubelet/)
237237

238238
<!--
239239
### Labels on the ReplicationController
@@ -243,7 +243,7 @@ would set these the same as the `.spec.template.metadata.labels`; if `.metadata.
243243
then it defaults to `.spec.template.metadata.labels`. However, they are allowed to be
244244
different, and the `.metadata.labels` do not affect the behavior of the ReplicationController.
245245
-->
246-
### ReplicationController 上的标签
246+
### ReplicationController 上的标签 {#labels-on-the-replicacontroller}
247247

248248
ReplicationController 本身可以有标签 (`.metadata.labels`)。
249249
通常,你可以将这些设置为 `.spec.template.metadata.labels`
@@ -298,10 +298,11 @@ shutdown, and a replacement starts early.
298298
299299
If you do not specify `.spec.replicas`, then it defaults to 1.
300300
-->
301-
### 多个副本
301+
### 多个副本 {#multiple-replicas}
302302

303303
你可以通过设置 `.spec.replicas` 来指定应该同时运行多少个 Pod。
304-
在任何时候,处于运行状态的 Pod 个数都可能高于或者低于设定值。例如,副本个数刚刚被增加或减少时,或者一个 Pod 处于优雅终止过程中而其替代副本已经提前开始创建时。
304+
在任何时候,处于运行状态的 Pod 个数都可能高于或者低于设定值。例如,副本个数刚刚被增加或减少时,
305+
或者一个 Pod 处于优雅终止过程中而其替代副本已经提前开始创建时。
305306

306307
如果你没有指定 `.spec.replicas`,那么它默认是 1。
307308

@@ -320,14 +321,14 @@ When using the REST API or [client library](/docs/reference/using-api/client-lib
320321
-->
321322
## 使用 ReplicationController {#working-with-replicationcontrollers}
322323

323-
### 删除一个 ReplicationController 以及它的 Pod
324+
### 删除一个 ReplicationController 以及它的 Pod {#deleteing-a-replicationcontroller-and-its-pods}
324325

325326
要删除一个 ReplicationController 以及它的 Pod,使用
326327
[`kubectl delete`](/docs/reference/generated/kubectl/kubectl-commands#delete)
327-
kubectl 将 ReplicationController 缩放为 0 并等待以便在删除 ReplicationController 本身之前删除每个 Pod。
328+
kubectl 将 ReplicationController 缩容为 0 并等待以便在删除 ReplicationController 本身之前删除每个 Pod。
328329
如果这个 kubectl 命令被中断,可以重新启动它。
329330

330-
当使用 REST API 或[客户端库](/zh-cn/docs/reference/using-api/client-libraries)时,你需要明确地执行这些步骤(缩放副本为 0、
331+
当使用 REST API 或[客户端库](/zh-cn/docs/reference/using-api/client-libraries)时,你需要明确地执行这些步骤(缩容副本为 0、
331332
等待 Pod 删除,之后删除 ReplicationController 资源)。
332333

333334
<!--
@@ -339,7 +340,7 @@ Using kubectl, specify the `--cascade=orphan` option to [`kubectl delete`](/docs
339340
340341
When using the REST API or [client library](/docs/reference/using-api/client-libraries), you can delete the ReplicationController object.
341342
-->
342-
### 只删除 ReplicationController
343+
### 只删除 ReplicationController {#deleting-only-a-replicationcontroller}
343344

344345
你可以删除一个 ReplicationController 而不影响它的任何 Pod。
345346

@@ -363,7 +364,7 @@ To update pods to a new spec in a controlled way, use a [rolling update](#rollin
363364
364365
Pods may be removed from a ReplicationController's target set by changing their labels. This technique may be used to remove pods from service for debugging and data recovery. Pods that are removed in this way will be replaced automatically (assuming that the number of replicas is not also changed).
365366
-->
366-
### 从 ReplicationController 中隔离 Pod
367+
### 从 ReplicationController 中隔离 Pod {#isolating-pods-from-a-replicationcontroller}
367368

368369
通过更改 Pod 的标签,可以从 ReplicationController 的目标中删除 Pod。
369370
此技术可用于从服务中删除 Pod 以进行调试、数据恢复等。以这种方式删除的 Pod
@@ -390,7 +391,7 @@ The ReplicationController enables scaling the number of replicas up or down, eit
390391
### 扩缩容 {#scaling}
391392

392393
通过设置 `replicas` 字段,ReplicationController 可以允许扩容或缩容副本的数量。
393-
你可以手动或通过自动缩放控制代理来控制 ReplicationController 执行此操作。
394+
你可以手动或通过自动扩缩控制代理来控制 ReplicationController 执行此操作。
394395

395396
<!--
396397
### Rolling updates
@@ -423,7 +424,7 @@ In addition to running multiple releases of an application while a rolling updat
423424
424425
For instance, a service might target all pods with `tier in (frontend), environment in (prod)`. Now say you have 10 replicated pods that make up this tier. But you want to be able to 'canary' a new version of this component. You could set up a ReplicationController with `replicas` set to 9 for the bulk of the replicas, with labels `tier=frontend, environment=prod, track=stable`, and another ReplicationController with `replicas` set to 1 for the canary, with labels `tier=frontend, environment=prod, track=canary`. Now the service is covering both the canary and non-canary pods. But you can mess with the ReplicationControllers separately to test things out, monitor the results, etc.
425426
-->
426-
### 多个版本跟踪
427+
### 多个版本跟踪 {#multiple-release-tracks}
427428

428429
除了在滚动更新过程中运行应用程序的多个版本之外,通常还会使用多个版本跟踪来长时间,
429430
甚至持续运行多个版本。这些跟踪将根据标签加以区分。
@@ -445,7 +446,7 @@ goes to the old version, and some goes to the new version.
445446
446447
A ReplicationController will never terminate on its own, but it isn't expected to be as long-lived as services. Services may be composed of pods controlled by multiple ReplicationControllers, and it is expected that many ReplicationControllers may be created and destroyed over the lifetime of a service (for instance, to perform an update of pods that run the service). Both services themselves and their clients should remain oblivious to the ReplicationControllers that maintain the pods of the services.
447448
-->
448-
### 和服务一起使用 ReplicationController
449+
### 和服务一起使用 ReplicationController {#using-replicationcontrollers-with-services}
449450

450451
多个 ReplicationController 可以位于一个服务的后面,例如,一部分流量流向旧版本,
451452
一部分流量流向新版本。
@@ -490,10 +491,10 @@ The ReplicationController is forever constrained to this narrow responsibility.
490491
-->
491492
ReplicationController 永远被限制在这个狭隘的职责范围内。
492493
它本身既不执行就绪态探测,也不执行活跃性探测。
493-
它不负责执行自动缩放,而是由外部自动缩放器控制(如
494+
它不负责执行自动扩缩,而是由外部自动扩缩器控制(如
494495
[#492](https://issue.k8s.io/492) 中所述),后者负责更改其 `replicas` 字段值。
495-
我们不会向 ReplicationController 添加调度策略(例如,
496-
[spreading](https://issue.k8s.io/367#issuecomment-48428019))
496+
我们不会向 ReplicationController 添加调度策略例如,
497+
[spreading](https://issue.k8s.io/367#issuecomment-48428019)
497498
它也不应该验证所控制的 Pod 是否与当前指定的模板匹配,因为这会阻碍自动调整大小和其他自动化过程。
498499
类似地,完成期限、整理依赖关系、配置扩展和其他特性也属于其他地方。
499500
我们甚至计划考虑批量创建 Pod 的机制(查阅 [#170](https://issue.k8s.io/170))。
@@ -503,7 +504,7 @@ The ReplicationController is intended to be a composable building-block primitiv
503504
-->
504505
ReplicationController 旨在成为可组合的构建基元。
505506
我们希望在它和其他补充原语的基础上构建更高级别的 API 或者工具,以便于将来的用户使用。
506-
kubectl 目前支持的 "macro" 操作(运行、缩放、滚动更新)就是这方面的概念示例。
507+
kubectl 目前支持的 "macro" 操作(运行、扩缩、滚动更新)就是这方面的概念示例。
507508
例如,我们可以想象类似于 [Asgard](https://netflixtechblog.com/asgard-web-based-cloud-management-and-deployment-2c9fc4e4d3a1)
508509
的东西管理 ReplicationController、自动定标器、服务、调度策略、金丝雀发布等。
509510

@@ -537,8 +538,7 @@ Note that we recommend using Deployments instead of directly using Replica Sets,
537538
支持新的[基于集合的标签选择算符](/zh-cn/docs/concepts/overview/working-with-objects/labels/#set-based-requirement)
538539
它主要被 [`Deployment`](/zh-cn/docs/concepts/workloads/controllers/deployment/)
539540
用来作为一种编排 Pod 创建、删除及更新的机制。
540-
请注意,我们推荐使用 Deployment 而不是直接使用 ReplicaSet,除非
541-
你需要自定义更新编排或根本不需要更新。
541+
请注意,我们推荐使用 Deployment 而不是直接使用 ReplicaSet,除非你需要自定义更新编排或根本不需要更新。
542542

543543
<!--
544544
### Deployment (Recommended)
@@ -555,15 +555,15 @@ because they are declarative, server-side, and have additional features.
555555
<!--
556556
### Bare Pods
557557
558-
Unlike in the case where a user directly created pods, a ReplicationController replaces pods that are deleted or terminated for any reason, such as in the case of node failure or disruptive node maintenance, such as a kernel upgrade. For this reason, we recommend that you use a ReplicationController even if your application requires only a single pod. Think of it similarly to a process supervisor, only it supervises multiple pods across multiple nodes instead of individual processes on a single node. A ReplicationController delegates local container restarts to some agent on the node (for example, Kubelet or Docker).
558+
Unlike in the case where a user directly created pods, a ReplicationController replaces pods that are deleted or terminated for any reason, such as in the case of node failure or disruptive node maintenance, such as a kernel upgrade. For this reason, we recommend that you use a ReplicationController even if your application requires only a single pod. Think of it similarly to a process supervisor, only it supervises multiple pods across multiple nodes instead of individual processes on a single node. A ReplicationController delegates local container restarts to some agent on the node, such as the kubelet.
559559
-->
560560
### 裸 Pod
561561

562-
与用户直接创建 Pod 的情况不同,ReplicationController 能够替换因某些原因
563-
被删除或被终止的 Pod,例如在节点故障或中断节点维护的情况下,例如内核升级。
562+
与用户直接创建 Pod 的情况不同,ReplicationController 能够替换因某些原因被删除或被终止的 Pod,
563+
例如在节点故障或中断节点维护的情况下,例如内核升级。
564564
因此,我们建议你使用 ReplicationController,即使你的应用程序只需要一个 Pod。
565565
可以将其看作类似于进程管理器,它只管理跨多个节点的多个 Pod,而不是单个节点上的单个进程。
566-
ReplicationController 将本地容器重启委托给节点上的某个代理(例如,Kubelet 或 Docker)。
566+
ReplicationController 将本地容器重启委托给节点上的某个代理(例如 Kubelet)。
567567

568568
<!--
569569
### Job
@@ -604,7 +604,7 @@ ReplicationController。
604604
-->
605605
## {{% heading "whatsnext" %}}
606606

607-
- 了解 [Pods](/zh-cn/docs/concepts/workloads/pods)
607+
- 了解 [Pod](/zh-cn/docs/concepts/workloads/pods)
608608
- 了解 [Depolyment](/zh-cn/docs/concepts/workloads/controllers/deployment/),ReplicationController 的替代品。
609609
- `ReplicationController` 是 Kubernetes REST API 的一部分,阅读 {{< api-reference page="workload-resources/replication-controller-v1" >}}
610610
对象定义以了解 replication controllers 的 API。

0 commit comments

Comments
 (0)