nerdexam
Linux_FoundationLinux_Foundation

CKAD · Question #11

CKAD Question #11: Real Exam Question with Answer & Explanation

This question tests your ability to create a Kubernetes CronJob that schedules a containerized command to run periodically, with a strict completion deadline enforced by the cluster.

Submitted by fernanda_arg· May 4, 2026Application Deployment

Question

Context: Developers occasionally need to submit pods that run periodically. Task: Follow the steps below to create a pod that will start at a predetermined time and which runs to completion only once each time it is started: * Create a YAML formatted Kubernetes manifest /opt/KDPD00301/periodic.yaml that runs the following shell command: date in a single busybox container. The command should run every minute and must complete within 42 seconds or be terminated by Kubernetes. The CronJob name and container name should both be hello. * Create the resource in the above manifest and verify that the job executes successfully at least once

Explanation

This question tests your ability to create a Kubernetes CronJob that schedules a containerized command to run periodically, with a strict completion deadline enforced by the cluster.

Approach. Create /opt/KDPD00301/periodic.yaml as a batch/v1 CronJob with schedule '*/1 * * * *' (every minute), CronJob name 'hello', a single busybox container also named 'hello' running the command 'date', and activeDeadlineSeconds: 42 set on the jobTemplate spec to enforce the 42-second termination limit. The restartPolicy on the pod template must be OnFailure or Never (not Always, which is forbidden in Jobs). Apply with 'kubectl apply -f /opt/KDPD00301/periodic.yaml', then verify with 'kubectl get cronjob hello' and 'kubectl get jobs --watch' until at least one Job shows COMPLETIONS 1/1. The key fields are: schedule (cron syntax), jobTemplate.spec.activeDeadlineSeconds (kill deadline), and matching names for both the CronJob metadata and the container.

Concept tested. Kubernetes CronJob creation - including cron schedule syntax, jobTemplate structure, activeDeadlineSeconds for timeout enforcement, correct restartPolicy for batch workloads, and verifying job execution via kubectl.

Reference. https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/

Topics

#CronJobs#Scheduling#Jobs#YAML Manifests

Community Discussion

No community discussion yet for this question.

Full CKAD PracticeBrowse All CKAD Questions