Certified Kubernetes Application Developer (CKAD) · Free practice question 4 of 12
Indexed Job completion index
A rendering Job at Mevagissey Films must split work into 8 shards, where each Pod knows which shard number (0-7) it owns without any external queue. Which Job configuration provides this?
- A.completions: 8 with podFailurePolicy, reading the restart count
- B.completionMode: Indexed with completions: 8, reading the JOB_COMPLETION_INDEX environment variable
- C.A CronJob with 8 schedules, one for each shard number
- D.completionMode: NonIndexed with parallelism: 8, reading the HOSTNAME suffix
Show answer and explanation
Correct answer: B. completionMode: Indexed with completions: 8, reading the JOB_COMPLETION_INDEX environment variable
Why: In an Indexed Job, each Pod gets a completion index from 0 to completions-1, exposed in the JOB_COMPLETION_INDEX environment variable and an annotation. NonIndexed Pods have random name suffixes, so no stable shard number. podFailurePolicy controls failure handling, and eight CronJob schedules would be a clumsy workaround that runs at different times.
More free Certified Kubernetes Application Developer (CKAD) questions
- Generating a Pod manifest skeleton
- Downward API Pod IP as env
- fsGroup for shared volume ownership
- Pulling and unpacking a chart locally
- Kustomize namePrefix and references
- Watching Pod status changes live
- tcpSocket probe for a non-HTTP server
- ExternalName Service for an outside host
- StatefulSet per-Pod DNS name
- Ways to consume a Secret in a container
- Checking quota usage in a namespace