Job Types
- Non-Parallel Job: A simple job where a single task is defined and which will create one pod and upon successful completion of the job the pod will terminate.
- Parallel Job with fixed completion count: A complex task is defined as a job that requires multiple pods to complete the task which can run in parallel and each Pod receives a unique index between 0 and.spec.completions-1 based on the number specified in config `.spec.completions`. The job will be considered completed successfully when there is a successful spec. completions Pods.
- Parallel Job with a work queue: In parallel jobs with a work queue, multiple pods are running in parallel to complete complex data with decencies. To decide what each Pod should focus on, the Pods will need to cooperate with one another or with an outside service. For instance, a Pod might pull up to N items in a batch from the work queue. Each Pod is capable of autonomously determining whether or not all of its peers are finished, and hence if the entire Job is finished.
Kubernetes – Jobs
Pre-requisite: Kubernetes
In the Kubernetes world, jobs are considered an object to act as a supervisor or controllers of a task. The Kubernetes job will create a pod, monitor the task, and recreate another one if that pod fails for some reason. Upon completion of the task, it will terminate the pod. Unlike deployment and pods, you can specify a job in Kubernetes which can be an always one job or time-based job, or a task-based job. This allows you to tolerate error or failure which can cause unexpected pods termination.
When you submit a job it will create one or more pods based on the requirement, will complete the task defined in the job, and keep the pods running until the task is completed. The Job keeps track of the successful completions when pods finish up. When a job is suspended, all of its active Pods are deleted until the job is restarted.