Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What is a Pod Disruption Budget (PDB) in Kubernetes?
A Pod Disruption Budget is a Kubernetes resource that limits the number of pods of a service that can be voluntarily disrupted at the same time, ensuring availability during maintenance or upgrades.
Click to reveal answer
beginner
Which field in a Pod Disruption Budget specifies how many pods can be unavailable during voluntary disruptions?
The maxUnavailable field sets the maximum number or percentage of pods that can be unavailable during voluntary disruptions.
Click to reveal answer
intermediate
What is the difference between voluntary and involuntary disruptions in Kubernetes?
Voluntary disruptions are planned actions like node draining or pod eviction. Involuntary disruptions are unexpected failures like node crashes. PDBs only control voluntary disruptions.
Click to reveal answer
intermediate
How does Kubernetes behave if a Pod Disruption Budget is violated during a voluntary disruption?
Kubernetes will block the voluntary disruption if it would cause the number of available pods to fall below the PDB's allowed threshold, protecting service availability.
Click to reveal answer
beginner
Show a simple YAML snippet of a Pod Disruption Budget that allows at most 1 pod to be unavailable.
What does a Pod Disruption Budget control in Kubernetes?
AThe CPU usage of pods
BThe total number of pods in a cluster
CThe number of pods that can be voluntarily disrupted at once
DThe network bandwidth of pods
✗ Incorrect
A Pod Disruption Budget limits voluntary disruptions to maintain availability.
Which of these is NOT controlled by a Pod Disruption Budget?
AUnexpected node crashes
BNode draining disruptions
CVoluntary pod evictions
DRolling updates
✗ Incorrect
PDBs do not control involuntary disruptions like node crashes.
In a PDB, what does setting maxUnavailable: 2 mean?
AAt most 2 pods can be unavailable during voluntary disruptions
BExactly 2 pods must be unavailable
CNo pods can be disrupted
D2 pods will be restarted automatically
✗ Incorrect
maxUnavailable sets the maximum number of pods allowed to be down during voluntary disruptions.
If a PDB is violated, what happens when you try to drain a node?
AThe node drains immediately ignoring the PDB
BThe drain command is blocked until pods are available
CThe pods are deleted forcibly
DNothing happens, PDBs are only informational
✗ Incorrect
Kubernetes blocks voluntary disruptions that violate the PDB to protect availability.
Which selector does a Pod Disruption Budget use to identify pods it protects?
AService selector
BNode selector
CNamespace selector
DLabel selector
✗ Incorrect
PDBs use label selectors to match the pods they protect.
Explain what a Pod Disruption Budget is and why it is important in Kubernetes.
Think about how Kubernetes manages pod availability during maintenance.
You got /4 concepts.
Describe how you would create a Pod Disruption Budget to allow only one pod to be disrupted at a time for an app labeled 'webapp'.
Focus on the key fields in the PDB YAML.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of a Pod Disruption Budget in Kubernetes?
easy
A. To ensure a minimum number of pods stay available during planned disruptions
B. To automatically restart pods when they crash
C. To scale pods up or down based on CPU usage
D. To backup pod data before deletion
Solution
Step 1: Understand Pod Disruption Budget purpose
A Pod Disruption Budget (PDB) is designed to keep your app available during planned changes by limiting voluntary disruptions.
Step 2: Match purpose to options
To ensure a minimum number of pods stay available during planned disruptions correctly states that PDB ensures a minimum number of pods remain running during disruptions, unlike other options which describe unrelated features.
Final Answer:
To ensure a minimum number of pods stay available during planned disruptions -> Option A
Quick Check:
Pod Disruption Budget = availability during disruptions [OK]
Hint: PDB = minimum pods running during planned changes [OK]
Common Mistakes:
Confusing PDB with auto-scaling
Thinking PDB restarts crashed pods
Assuming PDB backs up pod data
2. Which of the following is the correct way to specify a Pod Disruption Budget that allows at most 1 pod disruption at a time for pods with label app=web?
easy
A. apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: pdb-web
spec:
maxUnavailable: 1
selector:
matchLabels:
app: web
minReadySeconds: 10
B. apiVersion: v1
kind: PodDisruptionBudget
metadata:
name: pdb-web
spec:
minAvailable: 1
selector:
matchLabels:
app: web
C. apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: pdb-web
spec:
maxUnavailable: 1
selector:
matchLabels:
app: web
strategy: RollingUpdate
D. apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: pdb-web
spec:
maxUnavailable: 1
selector:
matchLabels:
app: web
Solution
Step 1: Check API version and kind
The correct API version for PDB is policy/v1 and kind is PodDisruptionBudget.
Step 2: Validate spec fields for maxUnavailable and selector
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: pdb-web
spec:
maxUnavailable: 1
selector:
matchLabels:
app: web correctly uses maxUnavailable: 1 and a selector matching label app: web. Other options either use wrong API version, extra unsupported fields, or wrong spec keys.
Final Answer:
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: pdb-web
spec:
maxUnavailable: 1
selector:
matchLabels:
app: web -> Option D
Quick Check:
Correct API and maxUnavailable syntax = apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: pdb-web
spec:
maxUnavailable: 1
selector:
matchLabels:
app: web [OK]
Hint: Use policy/v1 and maxUnavailable with correct selector [OK]
But Kubernetes reports an error: "spec.maxUnavailable: Invalid value: "2": must be less than the number of pods selected by the label selector". What is the likely cause?
medium
A. There are fewer than 3 pods with label app=database
B. maxUnavailable must be a percentage, not a number
C. The selector label is incorrect syntax
D. PodDisruptionBudget requires minAvailable, not maxUnavailable
Solution
Step 1: Understand maxUnavailable validation
maxUnavailable must be less than the total number of pods matched by the selector.
Step 2: Analyze error message meaning
The error says "must be less than the number of pods" meaning the number of pods with label app=database is less than or equal to 2.
Final Answer:
There are fewer than 3 pods with label app=database -> Option A
Quick Check:
maxUnavailable < total pods = error if not [OK]
Hint: maxUnavailable must be less than pod count [OK]
Common Mistakes:
Using maxUnavailable as percentage incorrectly
Miswriting selector labels
Thinking minAvailable is mandatory
5. You have a deployment with 10 pods labeled app=frontend. You want to ensure that during voluntary disruptions, at least 80% of pods remain available. Which Pod Disruption Budget spec is correct?
hard
A. spec:
minAvailable: 80
selector:
matchLabels:
app: frontend
B. spec:
maxUnavailable: 8
selector:
matchLabels:
app: frontend
C. spec:
maxUnavailable: 20%
selector:
matchLabels:
app: frontend
D. spec:
minAvailable: 20%
selector:
matchLabels:
app: frontend
Solution
Step 1: Understand percentage usage in PDB
maxUnavailable and minAvailable can accept percentages. To keep 80% available, maxUnavailable should be 20%.