Bird
0
0

You want to create a CronJob that runs a cleanup script every Sunday at 3 AM, but only if the previous job finished successfully. How can you ensure this behavior?

hard📝 Workflow Q9 of 15
Kubernetes - Scheduling
You want to create a CronJob that runs a cleanup script every Sunday at 3 AM, but only if the previous job finished successfully. How can you ensure this behavior?
ASet concurrencyPolicy to Forbid in the CronJob spec
BSet restartPolicy to Always in the Job template
CSet successfulJobsHistoryLimit to 0
DSet suspend to true in the CronJob spec
Step-by-Step Solution
Solution:
  1. Step 1: Understand concurrencyPolicy options

    Forbid prevents new job if previous is still running.
  2. Step 2: Match requirement to concurrencyPolicy

    Setting concurrencyPolicy to Forbid ensures no overlap and waits for success before next run.
  3. Final Answer:

    Set concurrencyPolicy to Forbid in the CronJob spec -> Option A
  4. Quick Check:

    ConcurrencyPolicy Forbid = no overlapping jobs [OK]
Quick Trick: Use concurrencyPolicy: Forbid to prevent overlapping jobs [OK]
Common Mistakes:
  • Using restartPolicy Always which affects pods, not job concurrency
  • Setting successfulJobsHistoryLimit affects history, not concurrency
  • Setting suspend true disables all runs

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes