Kubernetes 101 : Running several pods in parallel - Jobs-



A Job is a kubernetes resource, that executes one or more pods until one or more of them exits successfully.

To increase our chances of a Job running to completion, we could run several pods - Job - in parallel. 
These pods will run until one of them completes its task and exits.

The pods - Job - will get restarted if they fail until one of them completes its task successfully.

Below an example of a YAML file representing five pods - Job - running in parallel:


We create our Job using the below command:


We could check on our "parallel-running" pods using the below command with the "-w" parameters that allow us to watch the pods "live":


Because one of our pods "job1-lk5d" exited successfully, the Job ends.
Kubernetes will still wait for the other pods to exit gracefully.
In case one of the remaining pods fails, it will not be restarted.

Comments

Leave as a comment:

Archive