Disabling cronjob in Kubernetes

女生的网名这么多〃 提交于 2019-12-09 07:57:07

问题


I have scheduled an application to run as Cronjob in Kubernetes. When there is code change, I'm changing image in CronJob.

I'm looking for an option where I can disable currently running CronJob and deploy new CronJob with newly created Image.

How to disable a Cronjob in Kubernetes without deleting yaml?


回答1:


If you want to suspend cronjob via patch, use:

kubectl patch cronjobs <job-name> -p '{"spec" : {"suspend" : true }}'



回答2:


You can use something which will be valid with respect to Cron Job format but actually that date should not appear anytime in calendar date like 31 Feb.

* * 31 2 *



回答3:


kubectl patch cronjobs job-name -p "{\"spec\" : {\"suspend\" : true }}"


来源:https://stackoverflow.com/questions/52776690/disabling-cronjob-in-kubernetes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!