What is a use case for kubernetes job? What is a use case for kubernetes job? kubernetes kubernetes

What is a use case for kubernetes job?


A job retries pods until they complete, so that you can tolerate errors that cause pods to be deleted.

If you want to run a job repeatedly and periodically, you can use CronJob alpha or cronetes.

Some Helm Charts use Jobs to run install, setup, or test commands on clusters, as part of installing services. (Example).

If you save the YAML for the job then you can re-run it by deleting the old job an creating it again, or by editing the YAML to change the name (or use e.g. sed in a script).

You can watch a job's status with this command:

kubectl get jobs myjob -w

The -w option watches for changes. You are looking for the SUCCESSFUL column to show 1.

Here is a shell command loop to wait for job completion (e.g. in a script):until kubectl get jobs myjob -o jsonpath='{.status.conditions[?(@.type=="Complete")].status}' | grep True ; do sleep 1 ; done


One of the use case can be to take a backup of a DB. But as already mentioned that are some overheads to run a job e.g. When a Job completes the Pods are not deleted . so you need to manually delete the job(which will also delete the pods created by job). so recommended option will be to use Cron instead of Jobs