Course contentsShow
← Cloud and Infrastructure
Lesson 1198 of 2,98923. Kubernetes WorkloadsFree lesson

CronJob Concurrency Policies

Configure concurrencyPolicy (Allow, Forbid, Replace) to control behavior when previous Job runs overlap with new schedules.

CronJob Concurrency Policies

What you'll learn: How to control what happens when a new CronJob schedule fires before the previous Job finishes running.


In a CronJob, schedules sometimes overlap—imagine a backup job scheduled every minute that actually takes 90 seconds to complete. What should Kubernetes do when the next schedule arrives while the first Job is still running? That's where concurrency policies come in.

The Three Concurrency Policies

Kubernetes offers three behaviors via the concurrencyPolicy field:

1. Allow (default)
Permits multiple Jobs to run simultaneously. Each schedule creates a new Job, regardless of whether previous Jobs are still active. Think of it like allowing multiple checkout lanes at a store—everyone gets served in parallel.

2. Forbid
Blocks new Jobs if the previous Job is still running. The new schedule is simply skipped. Like a single-occupancy phone booth—if someone's inside, the next person has to wait for the next scheduled opportunity.

3. Replace
Cancels the currently running Job and starts a fresh one. The old Job is terminated, and the new schedule takes over. Similar to a treadmill with a time limit—when your session ends, you're immediately replaced by the next person, even if you weren't finished.

Choosing the Right Policy

  • Use Allow when tasks are independent and can safely run concurrently (e.g., generating separate reports).
  • Use Forbid when overlapping runs would cause conflicts (e.g., database migrations).
  • Use Replace when only the latest execution matters (e.g., fetching current weather data).

In your CronJob manifest, you specify this in the spec:

spec:
  concurrencyPolicy: Forbid

Key Takeaway: CronJob concurrency policies (Allow, Forbid, Replace) let you control whether overlapping Job executions run in parallel, get skipped, or replace each other—ensuring your scheduled workloads behave predictably under timing constraints.