DEV Community


Creating a one-off Kubernetes Job from a Failed CronJob

Joseph D. Marhee
Systems & Infrastructure Engineer
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.

Discussion (0)