{ "id": "pod-disruption-budget-task", "title": "Configure a PodDisruptionBudget", "category": "Cluster Administration", "difficulty": "Medium", "type": "task", "weight": 6, "description": "## PodDisruptionBudget\n\nA **PodDisruptionBudget (PDB)** limits the number of pods of a replicated application that are down simultaneously during voluntary disruptions (node drains, cluster upgrades). It is a critical CKA topic.\n\n**Your task:**\n\nA Deployment named `pdb-app` with **3 replicas** is already running. Create a **PodDisruptionBudget** named `web-pdb` in the `default` namespace that:\n- Applies to pods with the label `app=pdb-app`\n- Ensures **at least 2 pods** are always available (`minAvailable: 2`)\n\n```bash\n# Verify:\nkubectl get pdb web-pdb\n```", "hints": [ { "title": "PodDisruptionBudget manifest", "body": "Use `spec.minAvailable` (integer or percentage) and `spec.selector.matchLabels` to target the right pods.", "command": "cat </dev/null || true" }, { "command": "kubectl rollout status deployment/pdb-app --timeout=90s" } ], "validation": { "commands": [ { "description": "PDB 'web-pdb' exists", "command": "kubectl get pdb web-pdb -o jsonpath='{.metadata.name}'", "expected_output": "web-pdb", "match": "exact" }, { "description": "minAvailable is 2", "command": "kubectl get pdb web-pdb -o jsonpath='{.spec.minAvailable}'", "expected_output": "2", "match": "exact" }, { "description": "PDB selector targets app=pdb-app", "command": "kubectl get pdb web-pdb -o jsonpath='{.spec.selector.matchLabels.app}'", "expected_output": "pdb-app", "match": "exact" }, { "description": "Deployment 'pdb-app' has 3 replicas", "command": "kubectl get deployment pdb-app -o jsonpath='{.spec.replicas}'", "expected_output": "3", "match": "exact" } ] }, "default_namespace": "default", "teardown_commands": [ { "command": "kubectl delete pdb web-pdb --ignore-not-found" }, { "command": "kubectl delete deployment pdb-app --ignore-not-found" } ] }