Skip to content

Kubernetes Cron Jobs Concurrency-Policy

Posted on:October 9, 2024

To avoid cron jobs from starting a subsequent job while the first one is still running, you can use the concurrency-policy.

The spec may specify only one of the following concurrency policies:

Note that concurrency policy only applies to the Jobs created by the same CronJob. If there are multiple CronJobs, their respective Jobs are always allowed to run concurrently.

apiVersion: batch/v1
kind: CronJob
metadata:
  name: name
spec:
  schedule: "*/5 * * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
            - name: name
              image: ...
  concurrencyPolicy: Forbid | Allow | Replace

Details: Concurrency-policy