@@ -45,11 +45,11 @@ StatefulSet 是用来管理有状态应用的工作负载 API 对象。
4545## Using StatefulSets
4646
4747StatefulSets are valuable for applications that require one or more of the
48- following.
48+ following:
4949-->
5050## 使用 StatefulSet {#using-statefulsets}
5151
52- StatefulSet 对于需要满足以下一个或多个需求的应用程序很有价值。
52+ StatefulSet 对于需要满足以下一个或多个需求的应用程序很有价值:
5353
5454<!--
5555* Stable, unique network identifiers.
@@ -84,7 +84,7 @@ that provides a set of stateless replicas.
8484
8585<!--
8686* The storage for a given Pod must either be provisioned by a
87- [PersistentVolume Provisioner](/docs/concepts/storage/dynamic-provisioning/) ([examples here](https://github.com/kubernetes/examples/tree/master/staging/persistent-volume-provisioning/README.md))
87+ [PersistentVolume Provisioner](/docs/concepts/storage/dynamic-provisioning/)
8888 based on the requested _storage class_, or pre-provisioned by an admin.
8989* Deleting and/or scaling a StatefulSet down will *not* delete the volumes associated with the
9090 StatefulSet. This is done to ensure data safety, which is generally more valuable than an
@@ -102,7 +102,6 @@ that provides a set of stateless replicas.
102102-->
103103* 给定 Pod 的存储必须由
104104 [ PersistentVolume Provisioner] ( /zh-cn/docs/concepts/storage/dynamic-provisioning/ )
105- ([ 例子在这里] ( https://github.com/kubernetes/examples/tree/master/staging/persistent-volume-provisioning/README.md ) )
106105 基于所请求的 ** storage class** 来制备,或者由管理员预先制备。
107106* 删除或者扩缩 StatefulSet 并** 不会** 删除它关联的存储卷。
108107 这样做是为了保证数据安全,它通常比自动清除 StatefulSet 所有相关的资源更有价值。
@@ -277,22 +276,22 @@ validation error during StatefulSet creation.
277276# ## Volume Claim Templates
278277
279278You can set the `.spec.volumeClaimTemplates` field to create a
280- [PersistentVolumeClaim](/docs/concepts/storage/persistent-volumes/).
279+ [PersistentVolumeClaim](/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims) ).
281280This will provide stable storage to the StatefulSet if either
282281-->
283282# ## 卷申领模板 {#volume-claim-templates}
284283
285284你可以设置 `.spec.volumeClaimTemplates` 字段来创建
286- [PersistentVolumeClaim](/zh-cn/docs/concepts/storage/persistent-volumes/)。
285+ [PersistentVolumeClaim](/zh-cn/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims )。
287286这将为 StatefulSet 提供稳定的存储,如果:
288287
289288<!--
290289* The StorageClass specified for the volume claim is set up to use [dynamic
291- provisioning](/docs/concepts/storage/dynamic-provisioning/), or
290+ provisioning](/docs/concepts/storage/dynamic-provisioning/)
292291* The cluster already contains a PersistentVolume with the correct StorageClass
293292 and sufficient available storage space.
294293-->
295- * 为卷申领指定的 StorageClass 配置使用[动态制备](/zh-cn/docs/concepts/storage/dynamic-provisioning/),或
294+ * 为卷申领指定的 StorageClass 配置使用[动态制备](/zh-cn/docs/concepts/storage/dynamic-provisioning/)
296295* 集群已包含具有正确 StorageClass 和足够可用存储空间的 PersistentVolume。
297296
298297<!--
@@ -516,7 +515,7 @@ feature, in order to disable it, users will have to use server emulated version
516515
517516* 对于包含 N 个 副本的 StatefulSet,当部署 Pod 时,它们是依次创建的,顺序为 {0..N-1}。
518517* 当删除 Pod 时,它们是逆序终止的,顺序为 {N-1..0}。
519- * 在将扩缩操作应用到 Pod 之前,它前面的所有 Pod 必须是 Running 和 Ready 状态。
518+ * 在将扩缩操作应用到 Pod 之前,它前面的所有 Pod 必须是 ` Running` 和 ` Ready` 状态。
520519* 在一个 Pod 终止之前,所有的继任者必须完全关闭。
521520
522521<!--
@@ -537,11 +536,11 @@ web-2 is launched, web-2 will not be launched until web-0 is successfully relaun
537536becomes Running and Ready.
538537-->
539538在上面的 nginx 示例被创建后,会按照 web-0、web-1、web-2 的顺序部署三个 Pod。
540- 在 web-0 进入 [Running 和 Ready](/zh-cn/docs/concepts/workloads/pods/pod-lifecycle/)
541- 状态前不会部署 web-1。在 web-1 进入 Running 和 Ready 状态前不会部署 web-2。
542- 如果 web-1 已经处于 Running 和 Ready 状态,而 web-2 尚未部署,在此期间发生了
543- web-0 运行失败,那么 web-2 将不会被部署,要等到 web-0 部署完成并进入 Running 和
544- Ready 状态后,才会部署 web-2。
539+ 在 web-0 进入 [` Running` 和 ` Ready` ](/zh-cn/docs/concepts/workloads/pods/pod-lifecycle/)
540+ 状态前不会部署 web-1。在 web-1 进入 ` Running` 和 ` Ready` 状态前不会部署 web-2。
541+ 如果 web-1 已经处于 ` Running` 和 ` Ready` 状态,而 web-2 尚未部署,在此期间发生了
542+ web-0 运行失败,那么 web-2 将不会被部署,要等到 web-0 部署完成并进入 ` Running` 和
543+ ` Ready` 状态后,才会部署 web-2。
545544
546545<!--
547546If a user were to scale the deployed example by patching the StatefulSet such that
@@ -553,7 +552,7 @@ until web-0 is Running and Ready.
553552如果用户想将示例中的 StatefulSet 扩缩为 `replicas=1`,首先被终止的是 web-2。
554553在 web-2 没有被完全停止和删除前,web-1 不会被终止。
555554当 web-2 已被终止和删除、web-1 尚未被终止,如果在此期间发生 web-0 运行失败,
556- 那么就不会终止 web-1,必须等到 web-0 进入 Running 和 Ready 状态后才会终止 web-1。
555+ 那么就不会终止 web-1,必须等到 web-0 进入 ` Running` 和 ` Ready` 状态后才会终止 web-1。
557556
558557<!--
559558# ## Pod Management Policies
@@ -570,12 +569,12 @@ StatefulSet 允许你放宽其排序保证,
570569# ### OrderedReady Pod Management
571570
572571` OrderedReady` pod management is the default for StatefulSets. It implements the behavior
573- described [above ](#deployment-and-scaling-guarantees).
572+ described in [Deployment and Scaling Guarantees ](#deployment-and-scaling-guarantees).
574573-->
575574# ### OrderedReady Pod 管理 {#orderedready-pod-management}
576575
577576` OrderedReady` Pod 管理是 StatefulSet 的默认设置。
578- 它实现了[上面 ](#deployment-and-scaling-guarantees)描述的功能 。
577+ 它实现了[部署和扩缩保证 ](#deployment-and-scaling-guarantees)。
579578
580579<!--
581580# ### Parallel Pod Management
@@ -643,7 +642,7 @@ amount of time after the Pod turns ready, before moving on.
643642StatefulSet 控制器会删除和重建 StatefulSet 中的每个 Pod。
644643它将按照与 Pod 终止相同的顺序(从最大序号到最小序号)进行,每次更新一个 Pod。
645644
646- Kubernetes 控制平面会等到被更新的 Pod 进入 Running 和 Ready 状态,然后再更新其前身。
645+ Kubernetes 控制平面会等到被更新的 Pod 进入 ` Running` 和 ` Ready` 状态,然后再更新其前身。
647646如果你设置了 `.spec.minReadySeconds`(查看[最短就绪秒数](#minimum-ready-seconds)),
648647控制平面在 Pod 就绪后会额外等待一定的时间再执行下一步。
649648
@@ -723,7 +722,7 @@ StatefulSet will stop the rollout and wait.
723722-->
724723# ## 强制回滚 {#forced-rollback}
725724
726- 在默认 [Pod 管理策略](#pod-management-policies)( `OrderedReady`) 下使用[滚动更新](#rolling-updates),
725+ 在默认 [Pod 管理策略](#pod-management-policies)( `OrderedReady`) 下使用[滚动更新](#rolling-updates),
727726可能进入需要人工干预才能修复的损坏状态。
728727
729728如果更新后 Pod 模板配置进入无法运行或就绪的状态(例如,
@@ -756,7 +755,8 @@ StatefulSets use ControllerRevisions to maintain a revision history, enabling ro
756755-->
757756# # 修订版本历史 {#revision-history}
758757
759- ControllerRevision 是 Kubernetes 的一种 API 资源,由控制器(例如 StatefulSet 控制器)使用,用于跟踪配置变更历史。
758+ ControllerRevision 是 Kubernetes 的一种 API 资源,由控制器(例如 StatefulSet 控制器)使用,
759+ 用于跟踪配置变更历史。
760760
761761StatefulSet 使用 ControllerRevision 来维护修订版本历史,从而支持回滚和版本跟踪。
762762
@@ -771,7 +771,7 @@ When you update a StatefulSet's Pod template (`spec.template`), the StatefulSet
771771-->
772772# ## StatefulSet 如何通过 ControllerRevision 跟踪变更
773773
774- 当你更新 StatefulSet 的 Pod 模板 ( `spec.template`) 时,StatefulSet 控制器:
774+ 当你更新 StatefulSet 的 Pod 模板( `spec.template`) 时,StatefulSet 控制器:
775775
7767761. 准备新的 ControllerRevision 对象
7777772. 存储 Pod 模板和元数据的快照
@@ -780,12 +780,12 @@ When you update a StatefulSet's Pod template (`spec.template`), the StatefulSet
780780<!--
781781# ### Key Properties
782782
783- ControllerRevision key properties and other details can be checked [here ](/docs/reference/kubernetes-api/workload-resources/controller-revision-v1/)
783+ See [ControllerRevision ](/docs/reference/kubernetes-api/workload-resources/controller-revision-v1/) to learn more about key properties and other details.
784784-->
785785# ### 关键属性
786786
787- ControllerRevision 的关键属性和其他细节,
788- 请查阅[这里 ](/zh-cn/docs/reference/kubernetes-api/workload-resources/controller-revision-v1/)。
787+ 有关关键属性和其他细节,请参阅
788+ [ControllerRevision ](/zh-cn/docs/reference/kubernetes-api/workload-resources/controller-revision-v1/)。
789789
790790---
791791
@@ -892,16 +892,16 @@ kubectl get controllerrevision/webapp-3 -o yaml
892892
893893# #### Retention Policy
894894
895- - Set `revisionHistoryLimit` between **5–10** for most workloads
896- - Increase only if **deep rollback history** is required
895+ - Set `revisionHistoryLimit` between **5–10** for most workloads.
896+ - Increase only if **deep rollback history** is required.
897897-->
898898# ### 最佳实践
899899
900900# #### 保留策略
901901
902- - 对大多数工作负载,将 `revisionHistoryLimit` 设置为 **5–10**
902+ - 对大多数工作负载,将 `revisionHistoryLimit` 设置为 **5–10**。
903903
904- - 仅在需要**深度回滚历史**时才增加
904+ - 仅在需要**深度回滚历史**时才增加。
905905
906906<!--
907907# #### Monitoring
@@ -917,21 +917,21 @@ kubectl get controllerrevision/webapp-3 -o yaml
917917 ` ` `
918918
919919<!--
920- - Alert on **rapid revision count growth**
920+ - Alert on **rapid revision count growth**.
921921
922922# #### Avoid
923923
924924- Manual edits to ControllerRevision objects.
925925- Using revisions as a backup mechanism (use actual backup tools).
926926- Setting `revisionHistoryLimit : 0` (disables rollback capability).
927927-->
928- - 针对**修订版本数量快速增长**发出告警
928+ - 针对**修订版本数量快速增长**发出告警。
929929
930930# #### 避免
931931
932932- 手动编辑 ControllerRevision 对象。
933933- 将修订版本用作备份机制(使用实际的备份工具)。
934- - 设置 revisionHistoryLimit : 0(禁用回滚功能)。
934+ - 设置 ` revisionHistoryLimit : 0` (禁用回滚功能)。
935935
936936<!--
937937# # PersistentVolumeClaim retention
@@ -955,10 +955,10 @@ Once enabled, there are two policies you can configure for each StatefulSet:
955955
956956<!--
957957` whenDeleted`
958- : configures the volume retention behavior that applies when the StatefulSet is deleted
958+ : Configures the volume retention behavior that applies when the StatefulSet is deleted.
959959
960960` whenScaled`
961- : configures the volume retention behavior that applies when the replica count of
961+ : Configures the volume retention behavior that applies when the replica count of
962962 the StatefulSet is reduced; for example, when scaling down the set.
963963
964964For each policy that you can configure, you can set the value to either `Delete` or `Retain`.
@@ -1001,7 +1001,7 @@ the node where the new Pod is about to launch.
10011001
10021002The default for policies is `Retain`, matching the StatefulSet behavior before this new feature.
10031003
1004- Here is an example policy.
1004+ Here is an example policy :
10051005-->
10061006请记住,这些策略**仅**适用于由于 StatefulSet 被删除或被缩小而被删除的 Pod。
10071007例如,如果与 StatefulSet 关联的 Pod 由于节点故障而失败,
@@ -1010,7 +1010,7 @@ Here is an example policy.
10101010
10111011策略的默认值为 `Retain`,与此新功能之前的 StatefulSet 行为相匹配。
10121012
1013- 这是一个示例策略。
1013+ 这是一个示例策略:
10141014
10151015` ` ` yaml
10161016apiVersion: apps/v1
@@ -1101,7 +1101,8 @@ the `.spec.replicas` field automatically.
11011101如果 [HorizontalPodAutoscaler](/zh-cn/docs/tasks/run-application/horizontal-pod-autoscale/)
11021102(或任何类似的水平扩缩 API)正在管理 StatefulSet 的扩缩,
11031103请不要设置 `.spec.replicas`。
1104- 相反,允许 Kubernetes {{<glossary_tooltip text="控制平面" term_id="control-plane" >}}自动管理 `.spec.replicas` 字段。
1104+ 相反,允许 Kubernetes {{<glossary_tooltip text="控制平面" term_id="control-plane" >}}自动管理
1105+ ` .spec.replicas` 字段。
11051106
11061107# # {{% heading "whatsnext" %}}
11071108
@@ -1127,10 +1128,11 @@ the `.spec.replicas` field automatically.
11271128 * 跟随示例[使用 StatefulSet 部署 Cassandra](/zh-cn/docs/tutorials/stateful-application/cassandra/)。
11281129 * 跟随示例[运行多副本的有状态应用程序](/zh-cn/docs/tasks/run-application/run-replicated-stateful-application/)。
11291130 * 了解如何[扩缩 StatefulSet](/zh-cn/docs/tasks/run-application/scale-stateful-set/)。
1130- * 了解[删除 StatefulSet](/zh-cn/docs/tasks/run-application/delete-stateful-set/)涉及到的操作。
1131+ * 了解[删除 StatefulSet](/zh-cn/docs/tasks/run-application/delete-stateful-set/) 涉及到的操作。
11311132 * 了解如何[配置 Pod 以使用卷进行存储](/zh-cn/docs/tasks/configure-pod-container/configure-volume-storage/)。
11321133 * 了解如何[配置 Pod 以使用 PersistentVolume 作为存储](/zh-cn/docs/tasks/configure-pod-container/configure-persistent-volume-storage/)。
11331134* `StatefulSet` 是 Kubernetes REST API 中的顶级资源。阅读 {{< api-reference page="workload-resources/stateful-set-v1" >}}
1134- 对象定义理解关于该资源的 API。
1135- * 阅读 [Pod 干扰预算(Disruption Budget)](/zh-cn/docs/concepts/workloads/pods/disruptions/),了解如何在干扰下运行高度可用的应用。
1135+ 对象定义理解关于该资源的 API。
1136+ * 阅读 [Pod 干扰预算(Disruption Budget)](/zh-cn/docs/concepts/workloads/pods/disruptions/),
1137+ 了解如何在干扰下运行高度可用的应用。
11361138
0 commit comments