Skip to content

Commit 57c5d71

Browse files
authored
Merge pull request #43420 from my-git9/deployment123
[zh-cn] sync controllers/deployment.md
2 parents 047ced7 + fb3123e commit 57c5d71

File tree

1 file changed

+101
-0
lines changed

1 file changed

+101
-0
lines changed

content/zh-cn/docs/concepts/workloads/controllers/deployment.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2144,11 +2144,112 @@ For example, when this value is set to 30%, the new ReplicaSet can be scaled up
21442144
rolling update starts, such that the total number of old and new Pods does not exceed 130% of desired
21452145
Pods. Once old Pods have been killed, the new ReplicaSet can be scaled up further, ensuring that the
21462146
total number of Pods running at any time during the update is at most 130% of desired Pods.
2147+
2148+
Here are some Rolling Update Deployment examples that use the `maxUnavailable` and `maxSurge`:
21472149
-->
21482150
例如,当此值为 30% 时,启动滚动更新后,会立即对新的 ReplicaSet 扩容,同时保证新旧 Pod
21492151
的总数不超过所需 Pod 总数的 130%。一旦旧 Pod 被杀死,新的 ReplicaSet 可以进一步扩容,
21502152
同时确保更新期间的任何时候运行中的 Pod 总数最多为所需 Pod 总数的 130%。
21512153

2154+
以下是一些使用 `maxUnavailable``maxSurge` 的滚动更新 Deployment 的示例:
2155+
2156+
{{< tabs name="tab_with_md" >}}
2157+
{{% tab name="Max Unavailable" %}}
2158+
2159+
```yaml
2160+
apiVersion: apps/v1
2161+
kind: Deployment
2162+
metadata:
2163+
name: nginx-deployment
2164+
labels:
2165+
app: nginx
2166+
spec:
2167+
replicas: 3
2168+
selector:
2169+
matchLabels:
2170+
app: nginx
2171+
template:
2172+
metadata:
2173+
labels:
2174+
app: nginx
2175+
spec:
2176+
containers:
2177+
- name: nginx
2178+
image: nginx:1.14.2
2179+
ports:
2180+
- containerPort: 80
2181+
strategy:
2182+
type: RollingUpdate
2183+
rollingUpdate:
2184+
maxUnavailable: 1
2185+
```
2186+
2187+
{{% /tab %}}
2188+
{{% tab name="Max Surge" %}}
2189+
2190+
```yaml
2191+
apiVersion: apps/v1
2192+
kind: Deployment
2193+
metadata:
2194+
name: nginx-deployment
2195+
labels:
2196+
app: nginx
2197+
spec:
2198+
replicas: 3
2199+
selector:
2200+
matchLabels:
2201+
app: nginx
2202+
template:
2203+
metadata:
2204+
labels:
2205+
app: nginx
2206+
spec:
2207+
containers:
2208+
- name: nginx
2209+
image: nginx:1.14.2
2210+
ports:
2211+
- containerPort: 80
2212+
strategy:
2213+
type: RollingUpdate
2214+
rollingUpdate:
2215+
maxSurge: 1
2216+
```
2217+
2218+
{{% /tab %}}
2219+
{{% tab name="Hybrid" %}}
2220+
2221+
```yaml
2222+
apiVersion: apps/v1
2223+
kind: Deployment
2224+
metadata:
2225+
name: nginx-deployment
2226+
labels:
2227+
app: nginx
2228+
spec:
2229+
replicas: 3
2230+
selector:
2231+
matchLabels:
2232+
app: nginx
2233+
template:
2234+
metadata:
2235+
labels:
2236+
app: nginx
2237+
spec:
2238+
containers:
2239+
- name: nginx
2240+
image: nginx:1.14.2
2241+
ports:
2242+
- containerPort: 80
2243+
strategy:
2244+
type: RollingUpdate
2245+
rollingUpdate:
2246+
maxSurge: 1
2247+
maxUnavailable: 1
2248+
```
2249+
2250+
{{% /tab %}}
2251+
{{< /tabs >}}
2252+
21522253
<!--
21532254
### Progress Deadline Seconds
21542255

0 commit comments

Comments
 (0)