简体   繁体   中英

Is there a kubernetes cronjob kind which allows multiple schedules for a single container image?

If one has an image with a number of different executables, is it possible to have multiple cron entries with different commands that run at different times in the same kubernetes deployment.

eg For some single container image named "jolly-roger", I want to schedule the following crontab, without having to manage 4 separate kubernetes applications in different repositories.

*/30 * * * * /pirate-bin/rehoist-the-flag
0 7,19 * * * /pirate-bin/feed-the-sharks
45 20 * * * /pirate-bin/count-the-gold
0 12 * * 1,5 /pirate-bin/make-landlubbers-walk-the-plank

You can:

  • create a single cronjob resource with exactly one crontab time (like */30 * * * * ) and several containers to run
  • create several cronjob resources using the same container images but different command and args for each job

You can not:

  • create one cron job resource with several crontab times
  • consequently not using multiple containers with multiple crontab times

So in short, you can place all your binaries in a single container, but cannot solve your problem by defining one resource. The way to go is to use the same image in a distinct cronjob resource per crontab line of your example

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM