Lets say I have this application and one of the things it does is run a cron job. If I deploy my application using a rolling deployment in kubernetes, there will be a time where two instances of the cron job are running. What is the typical solution to this problem?
If it’s a CronJob it has a schedule associated with it. Why would there be a case where that was triggered based upon a rollout? Seems like creating a CJ in this manner may not be the best choice.
Not a kubernetes cronjob, but at the application level. If it triggers at 12:00, and there is a rollout happening at 12:00, it would trigger on the two versions running at the time.
This is just meant as an example of raciness with rolling deployments
Maybe the application needs the ability to communicate with other instances of the application when a job is in progress (lock file or lock entry in a database)? Or use a message queue to order the jobs.
Disclaimer: Not a software engineer, just going off patterns I’ve seen used at my job.
A lock entry sounds like a good idea actually