Creating a one-off Kubernetes Job from a Failed CronJob
Joseph D. Marhee
Posted on December 16, 2018
If you have a scheduled CronJob
in Kubernetes that has failed, or has no Pods available to complete the task, you can run the task as a Job instead to complete the task.
To create it from the manifest in Kubernetes for the existing CronJob, you can use the from argument with kubectl to define the source job to be templated for the new Job:
kubectl create job my-job --from=cronjob/my-cron-job
which will proceed to schedule the pods for this task.
💖 💪 🙅 🚩
Joseph D. Marhee
Posted on December 16, 2018
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.