Reputation: 163
In a K8S cluster when a Job has multiple pods under it, are these all replicas? Can a Job have 5 pods running under it and each of the pod is basically a different task?
Upvotes: 1
Views: 1220
Reputation: 780
If your steps are sequential and not in parallel, then you can just define multiple containers under the same job.
Upvotes: 0
Reputation: 163
I also started a discussion about this topic on Kubernetes community forum. Here is a discussion on it: https://discuss.kubernetes.io/t/can-a-job-have-multiple-distinct-tasks-running-in-different-pods-under-it/11575
As per that, a Job can only have a single pod spec. As a result even if a job has multiple pods deployed under it all of them will be mirror images of each other. There needs to a separate arrangement to make each of the pods do different things.
Upvotes: 0
Reputation: 2160
Yes, there is a provision for running multiple pods under a job either sequentially or in parallel. In the spec section of a Job, you can mention completions and it will be equivalent to the number of pods to be run sequentially.
And if you want to run them in parallel, similarly you can define parallelism and assign some value to this key in the spec part of Job yaml.
The former will take care of pods to complete execution successfully and later will define the limit of pods those can run in parallel.
Upvotes: 3