Kubernetes PodDisruptionBudget 与滚动升级稳定性实践PDB 示例(保证至少 2 个副本可用)apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: web-pdb
namespace: app
spec:
minAvailable: 2
selector:
matchLabels:
app: web
Deployment 滚动升级策略apiVersion: apps/v1
kind: Deployment
metadata:
name: web
namespace: app
spec:
replicas: 4
selector:
matchLabels:
app: web
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
maxSurge: 1
template:
metadata:
labels:
app: web
spec:
containers:
- name: web
image: example/web:latest
验证在节点维护或升级时观察可中断 Pod 数量与调度行为总结合理设置 PDB 与滚动参数,可在升级与维护期间保持服务稳定与受控中断。

发表评论 取消回复