Creating a one-off Kubernetes Job from a Failed CronJob

twitter logo github logo Originally published at Medium on ・1 min read

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.

twitter logo DISCUSS
Classic DEV Post from Jun 20 '19

What does a #codeNewbie need to start/improve?

Joseph D. Marhee profile image
Systems & Infrastructure Engineer

Sore eyes?

dev.to now has dark mode.

Go to the "misc" section of your settings and select night theme ❤️