‹ All CKAD questions

CKAD Practice Question 2: CronJob Overlapping Runs

Certified Kubernetes Application Developer (CKAD) · Test 1 · question 2 of 10

Application Design and Buildmedium

A CronJob scheduled at */15 * * * * exports data to a shared file. Most runs finish in about five minutes, but when the source system is slow a run takes more than twenty, and the next run starts while the previous one is still writing, corrupting the export.

The schedule must stay at every fifteen minutes, a run that is still in progress must never be interrupted, and no second Job may run alongside it. Which field should you set?

Select one answer
Show answer and explanation

Answer:

  • C. .spec.concurrencyPolicy: Forbid, so a scheduled run is skipped while the previous run has not finished

concurrencyPolicy controls how a CronJob treats overlapping executions of the Jobs it creates. Forbid means that if it is time for a new run and the previous run has not completed, the CronJob skips the new run entirely. The long-running Job is left alone, the schedule is unchanged, and the next tick after it finishes creates a new Job, precisely the required behaviour.

Option A misuses startingDeadlineSeconds. That field bounds how late a *missed* run may still be started; it does not prevent a run from starting while another is active, and setting it to 0 causes runs to be skipped for unrelated timing reasons.

Option B is the other concurrency policy, Replace, and it does the opposite of what the stem requires: it terminates the in-progress Job and starts a new one. The stem states that a run in progress must never be interrupted.

Option D confuses two levels. parallelism limits how many Pods a *single* Job runs at once; the default is already 1 here. It says nothing about two separate Jobs created by the CronJob at different scheduled times, which is the actual overlap.

Reference: CronJob

Practice Test 1 ›

Study guides for CKAD