---
title: Kubernetes PodDisruptionBudget 与滚动升级策略实践
keywords: PodDisruptionBudget, maxUnavailable, minReadySeconds, rollingUpdate, surge
description: 配置 PDB 限制自愿中断并优化 Deployment 滚动升级参数,保障服务在升级与节点维护期间的可用性。
tags:
- Kubernetes
- PodDisruptionBudget
- maxUnavailable
- minReadySeconds
- rollingUpdate
- surge
- 云原生
- 高可用
categories:
- 文章资讯
- 技术教程
---
PDB 限制自愿中断:
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: api-pdb
namespace: default
spec:
maxUnavailable: 1
selector:
matchLabels:
app: api
Deployment 滚动升级参数:
apiVersion: apps/v1
kind: Deployment
metadata:
name: api
spec:
replicas: 5
minReadySeconds: 10
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 2
maxUnavailable: 1
selector:
matchLabels:
app: api
template:
metadata:
labels:
app: api
spec:
containers:
- name: api
image: registry.example.com/app/api:v1.0.0
ports:
- containerPort: 3000

发表评论 取消回复