39 lines
1.0 KiB
YAML
39 lines
1.0 KiB
YAML
apiVersion: apps/v1
|
||
kind: Deployment
|
||
metadata:
|
||
name: nginx
|
||
spec:
|
||
replicas: 1
|
||
selector:
|
||
matchLabels:
|
||
app: nginx
|
||
strategy:
|
||
# highlight-start
|
||
type: RollingUpdate
|
||
rollingUpdate: # 单个串行升级,等新副本 ready 后才开始销毁旧副本
|
||
maxUnavailable: 0
|
||
maxSurge: 1
|
||
# highlight-end
|
||
template:
|
||
metadata:
|
||
labels:
|
||
app: nginx
|
||
spec:
|
||
containers:
|
||
- name: nginx
|
||
image: nginx:latest
|
||
startupProbe:
|
||
httpGet:
|
||
path: /
|
||
port: 80
|
||
# highlight-next-line
|
||
successThreshold: 5 # 新副本启动时,连续探测成功多次后才交给 readinessProbe 探测
|
||
periodSeconds: 5
|
||
readinessProbe:
|
||
httpGet:
|
||
path: /
|
||
port: 80
|
||
# highlight-next-line
|
||
successThreshold: 1 # 运行过程中探测 1 次成功就认为 ready,可在抖动导致异常后快速恢复服务
|
||
periodSeconds: 5
|