K8S PDB

pdb 控制pod自愿中断时,最大可用和不可用的pod数量,可能会在node drain时阻断维护进程。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: xiemx
name: xiemx
spec:
replicas: 3
selector:
matchLabels:
app: xiemx
template:
metadata:
labels:
app: xiemx
spec:
containers:
- image: busybox
name: busybox
command: ["sleep", "60"]

---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: xiemx-PDB
spec:
maxUnavailable: 1
selector:
matchLabels:
app: xiemx
1
2
3
➜  pdb git:(master) ✗ k get pdb
NAME MIN AVAILABLE MAX UNAVAILABLE ALLOWED DISRUPTIONS AGE
xiemx-PDB N/A 1 0 7s