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 与滚动参数,可在升级与维护期间保持服务稳定与受控中断。

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论
立即
投稿

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部