Hello CKADers, _Create a cron job with image busybox that runs every minute and . . .

Fernando Jimenez:
Let’s say you have a cronjob. That cronjob is nothing more than a job in an repeating schedule. Let’s say than you schedule it for one minute. That means every minute kubernetes is going to start a job and the job is going to start one or more pods to do the task(s). With that setup, there’s nothing that will guarantee that the pods are going to do finish within that period of time of one minute (between one started job and the next one). Which means that you might have multiple jobs running at the same time. However, if you want to guarantee that the job (the pods running) will not run for more than you want, then you setup activeDeadlineSeconds and Kuberentes will keep an eye and will not let it run more than that.

Fernando Jimenez:
I do agree that "start execution after its schedule" is the troubled part in the whole request.
A cronjob is going to try to make a job run continually until the job returns a completed (success). It will try and try with an added delay introduced each time and by default it will stop after six times. If what is asked is to prevent that from happening then the startingDeadlineSeconds might prevent from retrying. I might need to reconsider and recant my original affirmation that the answer is activeDeadlineSeconds. It seems that it makes more sense from that perspective.

pikachunetes:
Apologies for making the thread long @Fernando Jimenez
Acc. to the question we want to run a job every 60 seconds and want the job to fail _i_t takes more than 17 seconds to start execution after its schedule.
Let’s consider the job takes 20 seconds to execute,
So setting activeDeadlineSeconds=17 in the original question, Acc to me will not solve the purpose.
Rather setting startingDeadlineSeconds=17 will.
Pls, correct me if I am wrong.

pikachunetes:
So does it make startingDeadlineSeconds the correct answer or still I am missing something

Fernando Jimenez:
You are correct based that it appears to be referring to the cronjob and not to the work that the job has to do.

Fernando Jimenez:
Maybe it makes more sense to think like this:
If it is concerning with what the cronjob is doing, then startingDeadlineSeconds is the answer.
If it is concerning with what the Job is doing, then the activeDeadLineSeconds makes more sense.

pikachunetes:
thanks, I have understood now :slightly_smiling_face:

Shwetha Shenoy V:
This is the reason i visit this channel even after attaining the certification. For discussions like these. :thanks: