Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubernetes CronJob - Skip job if previous is still running AND wait for the next schedule time

I have scheduled the K8s cron to run every 30 mins.

If the current job is still running and the next cron schedule has reached it shouldn't create a new job but rather wait for the next schedule.

And repeat the same process if the previous job is still in Running state.

like image 604
k_vishwanath Avatar asked Oct 07 '18 18:10

k_vishwanath


1 Answers

set the following property to Forbid in CronJob yaml

.spec.concurrencyPolicy

https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/#concurrency-policy

like image 107
k_vishwanath Avatar answered Sep 21 '22 08:09

k_vishwanath