PDB — limit voluntary disruptions for availability.
1apiVersion: policy/v12kind: PodDisruptionBudget3metadata:4 name: myapp-pdb5spec:6 minAvailable: 2 # or maxUnavailable: 17 selector:8 matchLabels:9 app: myapp10---11# Percentage-based12apiVersion: policy/v113kind: PodDisruptionBudget14metadata:15 name: critical-pdb16spec:17 maxUnavailable: "10%"18 selector:19 matchLabels:20 app: critical21 unhealthyPodEvictionPolicy: AlwaysAllow
1# Commands2kubectl get pdb3kubectl describe pdb myapp-pdb45# Check disruption budget status6kubectl get pdb -o wide7kubectl get pdb myapp-pdb -o jsonpath='{.status}' | jq89# Test disruption10kubectl drain node-1 --ignore-daemonsets --delete-emptydir-data --force1112# Verify allowed disruptions13kubectl get pdb myapp-pdb -o jsonpath='{.status.disruptionsAllowed}'1415# Check current Pod count vs budget16kubectl get pdb myapp-pdb -o jsonpath='{.status.currentHealthy}/{.status.desiredHealthy}'
Disruptions:
Policies:
Best Practices:
kubectl drain.