[zh-cn] Resync 2022-05-27-maxunavailable-for-statefulset.md

pull/39421/head
Mengjiao Liu 2023-02-13 16:14:20 +08:00
parent 93bac34b77
commit 44f781d74c
1 changed files with 9 additions and 6 deletions

View File

@ -14,6 +14,8 @@ slug: maxunavailable-for-statefulset
-->
**作者:** Mayank Kumar (Salesforce)
**译者:** Xiaoyang ZhangHuawei
<!--
Kubernetes [StatefulSets](/docs/concepts/workloads/controllers/statefulset/), since their introduction in
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/
Here are some examples:
- I am using a StatefulSet to orchestrate a multi-instance, cache based application where the size of the cache is large. The cache
starts cold and requires some siginificant amount of time before the container can start. There could be more initial startup tasks
starts cold and requires some significant amount of time before the container can start. There could be more initial startup tasks
that are required. A RollingUpdate on this StatefulSet would take a lot of time before the application is fully updated. If the
StatefulSet supported updating more than one pod at a time, it would result in a much faster update.
-->
@ -82,7 +84,8 @@ spec:
app: nginx
spec:
containers:
- image: k8s.gcr.io/nginx-slim:0.8
# 镜像自发布以来已更改(以前使用的仓库为 "k8s.gcr.io"
- image: registry.k8s.io/nginx-slim:0.8
imagePullPolicy: IfNotPresent
name: nginx
updateStrategy:
@ -107,15 +110,15 @@ has 5 replicas, with `maxUnavailable` set to 2 and `partition` set to 0.
`maxUnavailable` 设置为 2 并将 `partition` 设置为 0。
<!--
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
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
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
complete. The maxUnavailable can be an absolute number (for example, 2) or a percentage of desired Pods (for example, 10%). The
absolute number is calculated from percentage by rounding down.
absolute number is calculated from percentage by rounding up to the nearest integer.
-->
我可以通过将镜像更改为 `k8s.gcr.io/nginx-slim:0.9` 来触发滚动更新。一旦开始滚动更新,
我可以通过将镜像更改为 `registry.k8s.io/nginx-slim:0.9` 来触发滚动更新。一旦开始滚动更新,
就可以看到一次更新 2 个 Pod因为 `maxUnavailable` 的当前值是 2。
下面的输出显示了一个时间段内的结果,但并不是完整过程。`maxUnavailable` 可以是绝对数值(例如 2或所需 Pod
的百分比(例如 10%),绝对数是通过百分比计算结果进行四舍五入得出的。
的百分比(例如 10%),绝对数是通过百分比计算结果进行四舍五入到最接近的整数得出的。
```
kubectl get pods --watch