How to prevent a Cronjob execution in Kubernetes if there is already a job running? concurrencyPolicy:Forbid stops the cron job execution altogether
I need a cron job to run every 5 minutes. If an earlier cron job is still running, another cron job should not start. I tried setting concurrency policy to Forbid, but then the cron job does not run at all.
- Job gets launched every 5 minutes as expected, but it launches even if the earlier cron job has not completed yet
spec:
concurrencyPolicy: Allow
schedule: '*/5 * * * *'
- This is supposed to solve the problem, but the cron job never gets launched with this approach
spec:
concurrencyPolicy: Forbid
schedule: '*/5 * * * *'
- Setting the startingDeadlineSeconds to 3600, or even to 10, did not make a difference.
spec:
concurrencyPolicy: Forbid
schedule: '*/5 * * * *'
startingDeadlineSeconds: 10
Could someone please help me here?