Claudio4's wiki

Search IconIcon to open search

Kubernetes jobs

Last updated

A Job creates one or more Pods and will continue to retry execution of the Pods until a specified number of them successfully terminate. Jobs are useful for batch processing or for one in a time workloads. For recurring jobs see CronJobs.

PODs in a Job ca be executed in parallel with the parallelism property, also each pod can be assigned an index with thecompletionMode: Indexed .

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# 3 POD will be created in sequence, each will have an index at the JOB_COMPLETION_INDEX envvar
apiVersion: batch/v1
kind: Job
metadata:
  name: pi
spec:
  completions: 3
  parallelism: 1
  completionMode: Indexed
  template:
    spec:
      containers:
      - name: pi
        image: perl
        command: ["perl",  "-Mbignum=bpi", "-wle", "print bpi(2000)"]
      restartPolicy: Never
  backoffLimit: 4

Interactive Graph