CKA CKA Workload Management and Scheduling 2 — Questions and Answers
Question 1: What is the primary use case for a DaemonSet in Kubernetes?
- Running a single instance of a Pod across the whole cluster
- Ensuring exactly one copy of a Pod runs on every (or selected) node (Correct answer)
- Running batch jobs that complete and terminate
- Managing stateful applications with persistent identities
Correct answer: Ensuring exactly one copy of a Pod runs on every (or selected) node
A DaemonSet guarantees that a Pod replica runs on each eligible node, making it ideal for node-level agents like log collectors or monitoring daemons.
Question 2: Which workload type provides stable network identities and ordered, graceful deployment for stateful applications?
- Deployment
- ReplicaSet
- StatefulSet (Correct answer)
- DaemonSet
Correct answer: StatefulSet
A StatefulSet gives each Pod a persistent, stable hostname and ordinal index, and manages ordered startup and shutdown for stateful apps like databases.
Question 3: What Kubernetes object should you use to run a task that executes to completion and then stops?
- Deployment
- Job (Correct answer)
- CronJob
- StatefulSet
Correct answer: Job
A Job creates one or more Pods to run a task to completion, tracks successes, and stops creating new Pods once the desired completions are reached.
Question 4: In a StatefulSet, what naming convention are Pod identities given?
- Random UUID suffixes like Deployments
- Sequential ordinal suffixes (e.g., web-0, web-1, web-2) (Correct answer)
- IP address-based names
- User-defined labels only
Correct answer: Sequential ordinal suffixes (e.g., web-0, web-1, web-2)
StatefulSet Pods receive names combining the StatefulSet name and an ordinal index (0, 1, 2...), providing stable, predictable identities across restarts.
Question 5: What happens to a Job's completed Pods by default after the Job finishes?
- They are deleted immediately
- They remain in Completed state so their logs can be inspected (Correct answer)
- They are restarted automatically
- They transition to a Pending state
Correct answer: They remain in Completed state so their logs can be inspected
Completed Pods from a Job are retained in a Completed state by default, allowing administrators to retrieve logs, until the Job or Pods are manually deleted.
Question 6: What field in a Job spec controls the maximum number of times a failed Pod will be retried before the Job is marked as failed?
- spec.completions
- spec.parallelism
- spec.backoffLimit (Correct answer)
- spec.activeDeadlineSeconds
Correct answer: spec.backoffLimit
The `backoffLimit` field sets the number of retries before a Job is declared failed, with an exponential back-off between each retry.
What is the primary use case for a DaemonSet in Kubernetes?