Skip to content

Commit 83a003b

Browse files
authored
Merge pull request #39421 from mengjiao-liu/resync-maxunavailable-for-statefulset
[zh-cn] Resync 2022-05-27-maxunavailable-for-statefulset.md
2 parents 93816c2 + 44f781d commit 83a003b

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

content/zh-cn/blog/_posts/2022-05-27-maxunavailable-for-statefulset.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ slug: maxunavailable-for-statefulset
1414
-->
1515
**作者:** Mayank Kumar (Salesforce)
1616

17+
**译者:** Xiaoyang Zhang(Huawei)
18+
1719
<!--
1820
Kubernetes [StatefulSets](/docs/concepts/workloads/controllers/statefulset/), since their introduction in
1921
1.5 and becoming stable in 1.9, have been widely used to run stateful applications. They provide stable pod identity, persistent
@@ -33,7 +35,7 @@ Kubernetes [StatefulSet](/zh-cn/docs/concepts/workloads/controllers/statefulset/
3335
Here are some examples:
3436
3537
- I am using a StatefulSet to orchestrate a multi-instance, cache based application where the size of the cache is large. The cache
36-
starts cold and requires some siginificant amount of time before the container can start. There could be more initial startup tasks
38+
starts cold and requires some significant amount of time before the container can start. There could be more initial startup tasks
3739
that are required. A RollingUpdate on this StatefulSet would take a lot of time before the application is fully updated. If the
3840
StatefulSet supported updating more than one pod at a time, it would result in a much faster update.
3941
-->
@@ -82,7 +84,8 @@ spec:
8284
app: nginx
8385
spec:
8486
containers:
85-
- image: k8s.gcr.io/nginx-slim:0.8
87+
# 镜像自发布以来已更改(以前使用的仓库为 "k8s.gcr.io")
88+
- image: registry.k8s.io/nginx-slim:0.8
8689
imagePullPolicy: IfNotPresent
8790
name: nginx
8891
updateStrategy:
@@ -107,15 +110,15 @@ has 5 replicas, with `maxUnavailable` set to 2 and `partition` set to 0.
107110
`maxUnavailable` 设置为 2 并将 `partition` 设置为 0。
108111

109112
<!--
110-
I can trigger a rolling update by changing the image to `k8s.gcr.io/nginx-slim:0.9`. Once I initiate the rolling update, I can
113+
I can trigger a rolling update by changing the image to `registry.k8s.io/nginx-slim:0.9`. Once I initiate the rolling update, I can
111114
watch the pods update 2 at a time as the current value of maxUnavailable is 2. The below output shows a span of time and is not
112115
complete. The maxUnavailable can be an absolute number (for example, 2) or a percentage of desired Pods (for example, 10%). The
113-
absolute number is calculated from percentage by rounding down.
116+
absolute number is calculated from percentage by rounding up to the nearest integer.
114117
-->
115-
我可以通过将镜像更改为 `k8s.gcr.io/nginx-slim:0.9` 来触发滚动更新。一旦开始滚动更新,
118+
我可以通过将镜像更改为 `registry.k8s.io/nginx-slim:0.9` 来触发滚动更新。一旦开始滚动更新,
116119
就可以看到一次更新 2 个 Pod,因为 `maxUnavailable` 的当前值是 2。
117120
下面的输出显示了一个时间段内的结果,但并不是完整过程。`maxUnavailable` 可以是绝对数值(例如 2)或所需 Pod
118-
的百分比(例如 10%),绝对数是通过百分比计算结果进行四舍五入得出的
121+
的百分比(例如 10%),绝对数是通过百分比计算结果进行四舍五入到最接近的整数得出的
119122

120123
```
121124
kubectl get pods --watch

0 commit comments

Comments
 (0)