CKA Workloads and Scheduling 3 ā Questions and Answers
Question 1: Which Kubernetes object automatically replaces a failed pod and maintains a specified number of replicas?
- Job
- ReplicaSet (Correct answer)
- StatefulSet
- DaemonSet
Correct answer: ReplicaSet
A ReplicaSet continuously monitors pod count and creates or deletes pods to maintain the desired number of replicas.
Question 2: You need pods of service A to prefer running on nodes that also run pods of service B. Which feature enables this?
- Pod affinity (Correct answer)
- Node affinity
- Pod anti-affinity
- Taints and tolerations
Correct answer: Pod affinity
Pod affinity lets you express that a pod should be scheduled near other pods matching a label selector, using requiredDuringScheduling or preferredDuringScheduling rules.
Question 3: A StatefulSet with 3 replicas is being deleted. In what order are the pods terminated by default?
- Simultaneously
- Ordinal order 0, 1, 2
- Reverse ordinal order 2, 1, 0 (Correct answer)
- Random order
Correct answer: Reverse ordinal order 2, 1, 0
StatefulSets terminate pods in reverse ordinal order (highest index first) by default to maintain ordering guarantees.
Question 4: What does the maxUnavailable field in a RollingUpdate deployment strategy control?
- Maximum number of pods that can be created above the desired count
- Maximum number of pods that can be unavailable during the update (Correct answer)
- Minimum number of pods that must be available at all times
- Number of old ReplicaSets to retain
Correct answer: Maximum number of pods that can be unavailable during the update
maxUnavailable defines how many pods can be unavailable (as a count or percentage) during a rolling update, controlling update speed vs. availability.
Question 5: Which scheduler feature allows you to manually assign a pod to a specific node without going through the scheduling algorithm?
- nodeSelector
- nodeName (Correct answer)
- nodeAffinity
- taints
Correct answer: nodeName
Setting spec.nodeName directly assigns a pod to a specific node, bypassing the scheduler entirely.
Question 6: A CronJob's concurrencyPolicy is set to Forbid. What happens if the previous job is still running when a new schedule triggers?
- The new job runs alongside the old one
- The old job is killed and a new one starts
- The new job is skipped (Correct answer)
- Both jobs are paused and rescheduled
Correct answer: The new job is skipped
With concurrencyPolicy: Forbid, the CronJob controller skips the new job execution if the previous job hasn't completed yet.
Question 7: Which command pauses a Deployment named 'web' to prevent new rollouts while you make multiple changes?
- kubectl stop deployment web
- kubectl rollout pause deployment/web (Correct answer)
- kubectl scale deployment web --replicas=0
- kubectl cordon deployment web
Correct answer: kubectl rollout pause deployment/web
kubectl rollout pause deployment/web halts the rollout controller so you can make several changes and then resume with a single rollout.
Which Kubernetes object automatically replaces a failed pod and maintains a specified number of replicas?