CKAD Certified CKAD 2 — Questions and Answers
Question 1: A Pod is stuck in 'Pending' state. Which command helps identify why it cannot be scheduled?
- kubectl logs <pod>
- kubectl describe pod <pod> (Correct answer)
- kubectl exec <pod> -- env
- kubectl get pod <pod> -o yaml
Correct answer: kubectl describe pod <pod>
kubectl describe pod shows Events including scheduler messages about insufficient resources or taint/toleration mismatches.
Question 2: Which field in a Pod spec controls the restart policy when a container exits?
- spec.policy
- spec.restartPolicy (Correct answer)
- spec.containers[].restartPolicy
- spec.lifecycle
Correct answer: spec.restartPolicy
spec.restartPolicy accepts Always, OnFailure, or Never and applies to all containers in the Pod.
Question 3: You need a container to run only once after another container is ready. Which Pod feature should you use?
- Init containers (Correct answer)
- Sidecar containers
- Ephemeral containers
- Pause containers
Correct answer: Init containers
Init containers run sequentially and must complete before app containers start, making them ideal for one-time setup tasks.
Question 4: Which kubectl command streams logs from all pods matching a label selector?
- kubectl logs -l app=web (Correct answer)
- kubectl logs --selector app=web --all
- kubectl logs app=web --follow
- kubectl get logs -l app=web
Correct answer: kubectl logs -l app=web
kubectl logs -l <selector> streams logs from all matching pods, with --follow for continuous streaming.
Question 5: A Deployment rollout is failing. Which command pauses the rollout so you can investigate?
- kubectl stop rollout deployment/myapp
- kubectl rollout pause deployment/myapp (Correct answer)
- kubectl deployment pause myapp
- kubectl set pause deployment/myapp
Correct answer: kubectl rollout pause deployment/myapp
kubectl rollout pause halts an ongoing rollout, allowing you to inspect state before deciding to resume or undo.
Question 6: What does a PodDisruptionBudget (PDB) with minAvailable: 2 guarantee?
- At most 2 pods can be disrupted simultaneously
- At least 2 pods remain available during voluntary disruptions (Correct answer)
- Exactly 2 pods are always running
- Pods are restarted if fewer than 2 are healthy
Correct answer: At least 2 pods remain available during voluntary disruptions
minAvailable: 2 ensures at least 2 pod replicas stay running during voluntary disruptions like node drains.
Question 7: Which resource type automatically manages pod identity and stable network names for stateful workloads?
- Deployment
- DaemonSet
- StatefulSet (Correct answer)
- ReplicaSet
Correct answer: StatefulSet
StatefulSet assigns each Pod a stable, unique ordinal identity and a persistent DNS name used throughout its lifetime.
A Pod is stuck in 'Pending' state.
Which command helps identify why it cannot be scheduled?