0
0
Kubernetesdevops~20 mins

Pod Disruption Budgets in Kubernetes - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Pod Disruption Budget Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding Pod Disruption Budget Purpose

What is the primary purpose of a Pod Disruption Budget (PDB) in Kubernetes?

ATo define resource limits for pods
BTo limit the number of pods that can be voluntarily disrupted at the same time
CTo scale pods up or down based on CPU usage
DTo automatically restart pods when they crash
Attempts:
2 left
💡 Hint

Think about how Kubernetes manages pod availability during maintenance or upgrades.

💻 Command Output
intermediate
2:00remaining
PDB Status After Node Drain

Given this Pod Disruption Budget YAML:

apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: myapp-pdb
spec:
  minAvailable: 2
  selector:
    matchLabels:
      app: myapp

Assuming 3 pods labeled app=myapp are running, what will be the status of the PDB after draining a node hosting 2 pods?

ADisruptionsAllowed: 1, CurrentHealthy: 2, DesiredHealthy: 2
BDisruptionsAllowed: 2, CurrentHealthy: 3, DesiredHealthy: 2
CDisruptionsAllowed: 0, CurrentHealthy: 1, DesiredHealthy: 2
DDisruptionsAllowed: 0, CurrentHealthy: 3, DesiredHealthy: 2
Attempts:
2 left
💡 Hint

Consider how many pods remain healthy after removing 2 pods from 3 total.

Configuration
advanced
2:30remaining
Correct PDB YAML for MaxUnavailable

Which YAML snippet correctly defines a Pod Disruption Budget that allows at most 1 pod to be unavailable at any time for pods labeled app=web?

A
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: web-pdb
spec:
  maxUnavailable: 1
  selector:
    matchLabels:
      app: web
B
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: web-pdb
spec:
  minAvailable: 1
  selector:
    matchLabels:
      app: web
C
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: web-pdb
spec:
  maxUnavailable: "one"
  selector:
    matchLabels:
      app: web
D
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: web-pdb
spec:
  maxUnavailable: 2
  selector:
    matchLabels:
      app: web
Attempts:
2 left
💡 Hint

Check the correct field name and value type for limiting unavailable pods.

Troubleshoot
advanced
2:00remaining
Why is PDB Not Blocking Pod Eviction?

You created a Pod Disruption Budget with minAvailable: 3 for pods labeled app=api. There are 5 pods running. However, when you drain a node hosting 3 pods, Kubernetes allows eviction and the pods terminate. Why?

AThe pods are not managed by a controller, so PDB is ignored
BminAvailable must be less than total pods, so 3 is invalid here
CPDB only works for involuntary disruptions, not node drains
DThe PDB selector does not match the pods because labels differ
Attempts:
2 left
💡 Hint

Check if the PDB selector matches the pods exactly.

🔀 Workflow
expert
3:00remaining
Sequence to Safely Upgrade Nodes with PDB

Arrange the steps in the correct order to safely upgrade Kubernetes nodes without violating Pod Disruption Budgets for a deployment with 4 replicas and minAvailable: 3.

A1,2,3,4
B2,1,3,4
C1,3,2,4
D3,1,2,4
Attempts:
2 left
💡 Hint

Think about preventing new pods, safely evicting existing pods, upgrading, then reopening the node.