kuberneteskubernetes-deploymentkubernetes-jobs

What is difference between Kubernetes Jobs & Deployments


I see that Kubernetes Job & Deployment provide very similar configuration. Both can deploy one or more pods with certain configuration. So I have few queries around these:


Solution

  • Many resources in Kubernetes use a Pod template. Both Deployments and Jobs use it, because they manage Pods.

    Controllers for workload resources create Pods from a pod template and manage those Pods on your behalf.

    PodTemplates are specifications for creating Pods, and are included in workload resources such as Deployments, Jobs, and DaemonSets.

    The main difference between Deployments and Jobs is how they handle a Pod that is terminated. A Deployment is intended to be a "service", e.g. it should be up-and-running, so it will try to restart the Pods it manage, to match the desired number of replicas. While a Job is intended to execute and successfully terminate.