0
0
Kubernetesdevops~10 mins

Pod Disruption Budgets in Kubernetes - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Pod Disruption Budgets
Define PDB YAML
Apply PDB to Cluster
Kubernetes Controller Watches PDB
Pod Eviction Request
Check PDB Conditions
Allow Eviction
Pod Removed
Shows how a Pod Disruption Budget (PDB) is defined, applied, and used by Kubernetes to allow or block pod evictions during disruptions.
Execution Sample
Kubernetes
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: my-pdb
spec:
  minAvailable: 2
  selector:
    matchLabels:
      app: myapp
Defines a PDB that requires at least 2 pods with label app=myapp to be available during disruptions.
Process Table
StepEventPods AvailableminAvailableEviction Allowed?Reason
1Initial state32YesPods meet minAvailable requirement
2Eviction request for 1 pod32YesEviction keeps pods >= minAvailable
3After eviction, pods available22N/APods still meet minAvailable
4Eviction request for another pod22NoEviction would reduce pods below minAvailable
5Eviction blocked22N/APDB prevents disruption
💡 Eviction blocked when pods available would drop below minAvailable
Status Tracker
VariableStartAfter Step 2After Step 3After Step 4Final
Pods Available33222
Eviction AllowedYesYesN/ANoNo
Key Moments - 2 Insights
Why is eviction allowed at step 2 but blocked at step 4?
At step 2, evicting one pod keeps the available pods at 2, which meets the minAvailable requirement (see execution_table rows 2 and 3). At step 4, evicting another pod would reduce pods below minAvailable, so eviction is blocked (execution_table row 4).
What does minAvailable mean in a Pod Disruption Budget?
minAvailable is the minimum number of pods that must be running during voluntary disruptions. Kubernetes uses this to decide if it can allow pod evictions without hurting availability (refer to execution_table column 'minAvailable').
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, how many pods are available after the first eviction?
A1
B2
C3
D0
💡 Hint
Check the 'Pods Available' column at Step 3 in the execution_table.
At which step does Kubernetes block pod eviction due to PDB?
AStep 2
BStep 3
CStep 4
DStep 1
💡 Hint
Look at the 'Eviction Allowed?' column in execution_table to find where eviction is 'No'.
If minAvailable was set to 1 instead of 2, what would happen at step 4?
AEviction would be allowed
BEviction would still be blocked
CPods available would increase
DPDB would be ignored
💡 Hint
Compare minAvailable value and pods available at step 4 in variable_tracker and execution_table.
Concept Snapshot
Pod Disruption Budget (PDB) controls voluntary pod evictions.
Define PDB with minAvailable or maxUnavailable.
Kubernetes checks PDB before evicting pods.
Eviction allowed only if availability stays above minAvailable.
Prevents too many pods going down at once.
Use PDB to keep app stable during maintenance.
Full Transcript
Pod Disruption Budgets help keep your app running smoothly by limiting how many pods can be taken down at once. You write a PDB YAML file specifying minAvailable pods. Kubernetes watches this and blocks pod evictions if removing a pod would drop availability below that number. For example, if you have 3 pods and minAvailable is 2, Kubernetes allows evicting one pod but blocks evicting a second pod until one comes back. This way, your app stays healthy during updates or node maintenance.