Skip to content

Commit a773e51

Browse files
authored
Merge pull request #26030 from tengqm/zh-resync-workloads
[zh] Resync concepts/workloads/_index.md
2 parents f7b2971 + 84cce5b commit a773e51

File tree

1 file changed

+98
-41
lines changed

1 file changed

+98
-41
lines changed

content/zh/docs/concepts/workloads/_index.md

Lines changed: 98 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ no_list: true
1717
<!--
1818
Whether your workload is a single component or several that work together, on Kubernetes you run
1919
it inside a set of [Pods](/docs/concepts/workloads/pods).
20-
In Kubernetes, a Pod represents a set of running {{< glossary_tooltip text="containers" term_id="container" >}}
21-
on your cluster.
20+
In Kubernetes, a Pod represents a set of running
21+
{{< glossary_tooltip text="containers" term_id="container" >}} on your cluster.
2222
2323
A Pod has a defined lifecycle. For example, once a Pod is running in your cluster then
2424
a critical failure on the {{< glossary_tooltip text="node" term_id="node" >}} where that
@@ -30,10 +30,18 @@ of failure as final: you would need to create a new Pod even if the node later r
3030
在 Kubernetes 中,Pod 代表的是集群上处于运行状态的一组
3131
{{< glossary_tooltip text="容器" term_id="container" >}}。
3232

33-
Pod 有确定的生命周期。例如,一旦某 Pod 在你的集群中运行,Pod 运行所在的
33+
<!--
34+
Kubernetes pods have a [defined lifecycle](/docs/concepts/workloads/pods/pod-lifecycle/).
35+
For example, once a pod is running in your cluster then a critical fault on the
36+
{{< glossary_tooltip text="node" term_id="node" >}} where that pod is running means that
37+
all the pods on that node fail. Kubernetes treats that level of failure as final: you
38+
would need to create a new `Pod` to recover, even if the node later becomes healthy.
39+
-->
40+
Kubernetes Pods 有[确定的生命周期](/zh/docs/concepts/workloads/pods/pod-lifecycle/)
41+
例如,一旦某 Pod 在你的集群中运行,Pod 运行所在的
3442
{{< glossary_tooltip text="节点" term_id="node" >}} 出现致命错误时,
3543
所有该节点上的 Pods 都会失败。Kubernetes 将这类失败视为最终状态:
36-
即使节点后来恢复正常运行,你也需要创建新的 Pod。
44+
即使该节点后来恢复正常运行,你也需要创建新的 Pod 来恢复应用
3745

3846
<!--
3947
However, to make life considerably easier, you don't need to manage each Pod directly.
@@ -42,48 +50,78 @@ These resources configure {{< glossary_tooltip term_id="controller" text="contro
4250
that make sure the right number of the right kind of Pod are running, to match the state
4351
you specified.
4452
45-
Those workload resources include:
53+
Kubernetes provides several built-in workload resources:
4654
-->
4755
不过,为了让用户的日子略微好过一些,你并不需要直接管理每个 Pod。
4856
相反,你可以使用 _负载资源_ 来替你管理一组 Pods。
4957
这些资源配置 {{< glossary_tooltip term_id="controller" text="控制器" >}}
5058
来确保合适类型的、处于运行状态的 Pod 个数是正确的,与你所指定的状态相一致。
5159

52-
这些工作负载资源包括
60+
Kubernetes 提供若干种内置的工作负载资源
5361

5462
<!--
5563
* [Deployment](/docs/concepts/workloads/controllers/deployment/) and [ReplicaSet](/docs/concepts/workloads/controllers/replicaset/)
56-
(replacing the legacy resource {{< glossary_tooltip text="ReplicationController" term_id="replication-controller" >}});
57-
* [StatefulSet](/docs/concepts/workloads/controllers/statefulset/);
58-
* [DaemonSet](/docs/concepts/workloads/controllers/daemonset/) for running Pods that provide
59-
node-local facilities, such as a storage driver or network plugin;
60-
* [Job](/docs/concepts/workloads/controllers/job/) and
61-
[CronJob](/docs/concepts/workloads/controllers/cron-jobs/)
62-
for tasks that run to completion.
64+
(replacing the legacy resource
65+
{{< glossary_tooltip text="ReplicationController" term_id="replication-controller" >}}).
66+
`Deployment` is a good fit for managing a stateless application workload on your cluster,
67+
where any `Pod` in the `Deployment` is interchangeable and can be replaced if needed.
68+
* [`StatefulSet`](/docs/concepts/workloads/controllers/statefulset/) lets you
69+
run one or more related Pods that do track state somehow. For example, if your workload
70+
records data persistently, you can run a `StatefulSet` that matches each `Pod` with a
71+
[`PersistentVolume`](/docs/concepts/storage/persistent-volumes/). Your code, running in the
72+
`Pods` for that `StatefulSet`, can replicate data to other `Pods` in the same `StatefulSet`
73+
to improve overall resilience.
6374
-->
6475
* [Deployment](/zh/docs/concepts/workloads/controllers/deployment/)
6576
[ReplicaSet](/zh/docs/concepts/workloads/controllers/replicaset/)
66-
(替换原来的资源 {{< glossary_tooltip text="ReplicationController" term_id="replication-controller" >}});
67-
* [StatefulSet](/zh/docs/concepts/workloads/controllers/statefulset/);
68-
* 用来运行提供节点本地支撑设施(如存储驱动或网络插件)的 Pods 的
69-
[DaemonSet](/zh/docs/concepts/workloads/controllers/daemonset/)
70-
* 用来执行运行到结束为止的
71-
[Job](/zh/docs/concepts/workloads/controllers/job/)
77+
(替换原来的资源 {{< glossary_tooltip text="ReplicationController" term_id="replication-controller" >}})。
78+
`Deployment` 很适合用来管理你的集群上的无状态应用,`Deployment` 中的所有
79+
`Pod` 都是相互等价的,并且在需要的时候被换掉。
80+
* [StatefulSet](/zh/docs/concepts/workloads/controllers/statefulset/)
81+
让你能够运行一个或者多个以某种方式跟踪应用状态的 Pods。
82+
例如,如果你的负载会将数据作持久存储,你可以运行一个 `StatefulSet`,将每个
83+
`Pod` 与某个 [`PersistentVolume`](/zh/docs/concepts/storage/persistent-volumes/)
84+
对应起来。你在 `StatefulSet` 中各个 `Pod` 内运行的代码可以将数据复制到同一
85+
`StatefulSet` 中的其它 `Pod` 中以提高整体的服务可靠性。
86+
<!--
87+
* [`DaemonSet`](/docs/concepts/workloads/controllers/daemonset/) defines `Pods` that provide
88+
node-local facilities. These might be fundamental to the operation of your cluster, such
89+
as a networking helper tool, or be part of an
90+
{{< glossary_tooltip text="add-on" term_id="addons" >}}.
91+
Every time you add a node to your cluster that matches the specification in a `DaemonSet`,
92+
the control plane schedules a `Pod` for that `DaemonSet` onto the new node.
93+
* [`Job`](/docs/concepts/workloads/controllers/job/) and
94+
[`CronJob`](/docs/concepts/workloads/controllers/cron-jobs/)
95+
define tasks that run to completion and then stop. Jobs represent one-off tasks, whereas
96+
`CronJobs` recur according to a schedule.
97+
-->
98+
* [DaemonSet](/zh/docs/concepts/workloads/controllers/daemonset/)
99+
定义提供节点本地支撑设施的 `Pods`。这些 Pods 可能对于你的集群的运维是
100+
非常重要的,例如作为网络链接的辅助工具或者作为网络
101+
{{< glossary_tooltip text="插件" term_id="addons" >}}
102+
的一部分等等。每次你向集群中添加一个新节点时,如果该节点与某 `DaemonSet`
103+
的规约匹配,则控制面会为该 `DaemonSet` 调度一个 `Pod` 到该新节点上运行。
104+
* [Job](/zh/docs/concepts/workloads/controllers/job/)
72105
[CronJob](/zh/docs/concepts/workloads/controllers/cron-jobs/)
106+
定义一些一直运行到结束并停止的任务。`Job` 用来表达的是一次性的任务,而
107+
`CronJob` 会根据其时间规划反复运行。
73108

74109
<!--
75-
There are also two supporting concepts that you might find relevant:
76-
* [Garbage collection](/docs/concepts/workloads/controllers/garbage-collection/) tidies up objects
77-
from your cluster after their _owning resource_ has been removed.
78-
* The [_time-to-live after finished_ controller](/docs/concepts/workloads/controllers/ttlafterfinished/)
79-
removes Jobs once a defined time has passed since they completed.
110+
In the wider Kubernetes ecosystem, you can find third-party workload resources that provide
111+
additional behaviors. Using a
112+
[custom resource definition](/docs/concepts/extend-kubernetes/api-extension/custom-resources/),
113+
you can add in a third-party workload resource if you want a specific behavior that's not part
114+
of Kubernetes' core. For example, if you wanted to run a group of `Pods` for your application but
115+
stop work unless _all_ the Pods are available (perhaps for some high-throughput distributed task),
116+
then you can implement or install an extension that does provide that feature.
80117
-->
81-
你可能发现还有两种支撑概念很有用:
82-
83-
* [垃圾收集](/zh/docs/concepts/workloads/controllers/garbage-collection/)机制负责在
84-
对象的 _属主资源_ 被删除时在集群中清理这些对象。
85-
* [_结束后存在时间_ 控制器](/zh/docs/concepts/workloads/controllers/ttlafterfinished/)
86-
会在 Job 结束之后的指定时间间隔之后删除它们。
118+
在庞大的 Kubernetes 生态系统中,你还可以找到一些提供额外操作的第三方
119+
工作负载资源。通过使用
120+
[定制资源定义(CRD)](/zh/docs/concepts/extend-kubernetes/api-extension/custom-resources/)
121+
你可以添加第三方工作负载资源,以完成原本不是 Kubernetes 核心功能的工作。
122+
例如,如果你希望运行一组 `Pods`,但要求所有 Pods 都可用时才执行操作
123+
(比如针对某种高吞吐量的分布式任务),你可以实现一个能够满足这一需求
124+
的扩展,并将其安装到集群中运行。
87125

88126
## {{% heading "whatsnext" %}}
89127

@@ -93,26 +131,45 @@ As well as reading about each resource, you can learn about specific tasks that
93131
* [Run a stateless application using a Deployment](/docs/tasks/run-application/run-stateless-application-deployment/)
94132
* Run a stateful application either as a [single instance](/docs/tasks/run-application/run-single-instance-stateful-application/)
95133
or as a [replicated set](/docs/tasks/run-application/run-replicated-stateful-application/)
96-
* [Run Automated Tasks with a CronJob](/docs/tasks/job/automated-tasks-with-cron-jobs/)
134+
* [Run Automated Tasks with a `CronJob`](/docs/tasks/job/automated-tasks-with-cron-jobs/)
97135
-->
98136
除了阅读了解每类资源外,你还可以了解与这些资源相关的任务:
99137

100138
* [使用 Deployment 运行一个无状态的应用](/zh/docs/tasks/run-application/run-stateless-application-deployment/)
101139
*[单实例](/zh/docs/tasks/run-application/run-single-instance-stateful-application/)
102140
或者[多副本集合](/zh/docs/tasks/run-application/run-replicated-stateful-application/)
103141
的形式运行有状态的应用;
104-
* [使用 CronJob 运行自动化的任务](/zh/docs/tasks/job/automated-tasks-with-cron-jobs/)
142+
* [使用 `CronJob` 运行自动化的任务](/zh/docs/tasks/job/automated-tasks-with-cron-jobs/)
105143

106144
<!--
107-
Once your application is running, you might want to make it available on the internet as
108-
a [Service](/docs/concepts/services-networking/service/) or, for web application only,
109-
using an [Ingress](/docs/concepts/services-networking/ingress).
145+
To learn about Kubernetes' mechanisms for separating code from configuration,
146+
visit [Configuration](/docs/concepts/configuration/).
147+
-->
148+
要了解 Kubernetes 将代码与配置分离的实现机制,可参阅
149+
[配置部分](/zh/docs/concepts/configuration/)
110150

111-
You can also visit [Configuration](/docs/concepts/configuration/) to learn about Kubernetes'
112-
mechanisms for separating code from configuration.
151+
<!--
152+
There are two supporting concepts that provide backgrounds about how Kubernetes manages pods
153+
for applications:
154+
* [Garbage collection](/docs/concepts/workloads/controllers/garbage-collection/) tidies up objects
155+
from your cluster after their _owning resource_ has been removed.
156+
* The [_time-to-live after finished_ controller](/docs/concepts/workloads/controllers/ttlafterfinished/)
157+
removes Jobs once a defined time has passed since they completed.
158+
-->
159+
关于 Kubernetes 如何为应用管理 Pods,还有两个支撑概念能够提供相关背景信息:
160+
161+
* [垃圾收集](/zh/docs/concepts/workloads/controllers/garbage-collection/)机制负责在
162+
对象的 _属主资源_ 被删除时在集群中清理这些对象。
163+
* [_Time-to-Live_ 控制器](/zh/docs/concepts/workloads/controllers/ttlafterfinished/)
164+
会在 Job 结束之后的指定时间间隔之后删除它们。
165+
166+
<!--
167+
Once your application is running, you might want to make it available on the internet as
168+
a [`Service`](/docs/concepts/services-networking/service/) or, for web application only,
169+
using an [`Ingress`](/docs/concepts/services-networking/ingress).
113170
-->
114-
一旦你的应用处于运行状态,你就可能想要
115-
[服务](/zh/docs/concepts/services-networking/service/)
116-
使之在互联网上可访问;或者对于 Web 应用而言,使用
117-
[Ingress](/zh/docs/concepts/services-networking/ingress) 资源将其暴露到互联网上。
171+
一旦你的应用处于运行状态,你就可能想要以
172+
[`Service`](/zh/docs/concepts/services-networking/service/)
173+
的形式使之可在互联网上访问;或者对于 Web 应用而言,使用
174+
[`Ingress`](/zh/docs/concepts/services-networking/ingress) 资源将其暴露到互联网上。
118175

0 commit comments

Comments
 (0)