Jobs have a much shorter lifecycle most Kubernetes resources, which are designed to maintain long-lived instances. They allow executing one or pods and ensuring that a minimum number of them complete successfully, and are ideal for modelling ad hoc or batch jobs.
apiVersion: batch/v1 kind: Job metadata: name: spec: template: spec: containers: - name: image: command: - /something restartPolicy: Never
Success of a job is determined by a container's exit status. The behaviour to take on failure is determined by the pod's
Alwaysis incompatible, as successful completion should terminate the pod.
Failureallows the pod to restart and retry on failure.
Nevercauses the job to be marked as failed after the first failed execution.
backoffLimitsets the maximum number of allowed retries (default 6).
activeDeadlineSecondssets the maximum execution time.
parallelismsets the maximum number of pods that may be in the running state in a job at any time.
completionssets the number of pods which must complete successfully to consider the job completed.
The job controller will reschedule a job upon interrupted execution.
Job objects are preserved upon completion, allowing clients to check the status of completed jobs. The status of the execution can be determined by looking at the exit status of the pods, which are preserved (along with their logs). Pods are deleted with the job.