Skip to content

Commit

Permalink
Merge pull request #43420 from my-git9/deployment123
Browse files Browse the repository at this point in the history
[zh-cn] sync controllers/deployment.md
  • Loading branch information
k8s-ci-robot authored Oct 11, 2023
2 parents 047ced7 + fb3123e commit 57c5d71
Showing 1 changed file with 101 additions and 0 deletions.
101 changes: 101 additions & 0 deletions content/zh-cn/docs/concepts/workloads/controllers/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -2144,11 +2144,112 @@ For example, when this value is set to 30%, the new ReplicaSet can be scaled up
rolling update starts, such that the total number of old and new Pods does not exceed 130% of desired
Pods. Once old Pods have been killed, the new ReplicaSet can be scaled up further, ensuring that the
total number of Pods running at any time during the update is at most 130% of desired Pods.
Here are some Rolling Update Deployment examples that use the `maxUnavailable` and `maxSurge`:
-->
例如,当此值为 30% 时,启动滚动更新后,会立即对新的 ReplicaSet 扩容,同时保证新旧 Pod
的总数不超过所需 Pod 总数的 130%。一旦旧 Pod 被杀死,新的 ReplicaSet 可以进一步扩容,
同时确保更新期间的任何时候运行中的 Pod 总数最多为所需 Pod 总数的 130%。

以下是一些使用 `maxUnavailable``maxSurge` 的滚动更新 Deployment 的示例:

{{< tabs name="tab_with_md" >}}
{{% tab name="Max Unavailable" %}}

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
```
{{% /tab %}}
{{% tab name="Max Surge" %}}
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
```
{{% /tab %}}
{{% tab name="Hybrid" %}}
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
```
{{% /tab %}}
{{< /tabs >}}
<!--
### Progress Deadline Seconds
Expand Down

0 comments on commit 57c5d71

Please sign in to comment.