Kubernetes (K8s) (50 Qs)•Part 3: Advanced Internals, Scale & Production Security (Senior / Lead)
Pod Disruption Budgets (PDB) & Safe Node Maintenance.
senior LevelMost AskedCode ExampleSecurity & AuthKubernetesApache Kafka
In Simple Words: When cloud providers perform node upgrades or when Karpenter drains nodes for bin-packing, pods are evicted:
- If all 3 replicas of your payment API are evicted simultaneously -> Outage!
- Pod Disruption Budget (PDB): Enforces high-availability constraints during voluntary disruptions:
Theyaml
apiVersion: policy/v1 kind: PodDisruptionBudget metadata: name: payment-api-pdb spec: minAvailable: 2 # Kubernetes REFUSES to drain a node if it drops healthy pods below 2! selector: matchLabels: app: payment-apikubectl draincommand blocks safely until replacement pods are running and healthy on another node.