Hi all, wondering why Kubernetes needs to support Jobs when Replica Sets could b . . .

Sundar Nadathur:
Hi all, wondering why Kubernetes needs to support Jobs when Replica Sets could be used for the same purpose.
• Specifically, a replica set (or deployment) with replicas: N and pod restartPolicy: OnFailure would restart only failed pods and and thus achieve N successful completions, just as a Job with completions: N, right?
• The one difference I see is that Jobs supports control of parallelism.

Mike K:
Parallelism is, of course, very important, but I think even more important is to give your cluster a break if several pods are failing simultaneously. The backoffLimit along with activeDeadlineSeconds handle that in Jobs. Another aspect is the logs for the pods that fail. If you have N pods for N completions but pods had to be restarted M times, you’d not be able to find the logs for all of them. Finally, you are discouraged from using Replica Sets by themselves. Their functionality is better implemented by Deployments.

Mike K:
https://kubernetes.io/docs/concepts/workloads/controllers/job/#replication-controller

Mike K:
tl;dr - Deployments for pods that are not expected to terminate, and Jobs for pods that run tasks that are expected to terminate