DEV Community

Cover image for Kubernetes Patterns : The Cron Job Pattern
Ahmed Atef
Ahmed Atef

Posted on • Originally published at magalix.com

Kubernetes Patterns : The Cron Job Pattern

My Cron Job Didn't Start On Time. What Should I Do?
In some cases, the CronJob may not get triggered on the specified time. In such an event, there are two scenarios:

We need to execute the job that didn't start even if it was delayed.
We need to execute the job that didn't start only if a specific time limit was not crossed.
In our first example, the job sends information to an API that expects this information every fifteen minutes. If the data arrives late, it's useless, and the API automatically discards it. The CronJob resource offers the. spec. startingDeadlineSeconds parameter:

.spec.startingDeadlineSeconds: If the job misses the scheduled time and did not exceed that number of seconds, it should get executed. Otherwise, it is executed on the next scheduled time.

otice that if this parameter is not set, the CronJob counts all the missed jobs since the last successful execution and reschedules them with a maximum of 100 missed job. If the number of missing jobs exceeds 100, the cron job is not rescheduled.
For More information see: https://www.magalix.com/blog/kubernetes-patterns-the-cron-job-pattern

Top comments (0)