Skip to content

Latest commit

 

History

History
49 lines (34 loc) · 1.81 KB

K8s-Job.md

File metadata and controls

49 lines (34 loc) · 1.81 KB

LAB: K8s Job

This scenario shows how K8s job object works on minikube

Steps

apiVersion: batch/v1
kind: Job
metadata:
  name: pi
spec:
  parallelism: 2               # each step how many pods start in parallel at a time
  completions: 10              # number of pods that run and complete job at the end of the time
  backoffLimit: 5              # to tolerate fail number of job, after 5 times of failure, not try to continue job, fail the job
  activeDeadlineSeconds: 100   # if this job is not completed in 100 seconds, fail the job
  template:
    spec:
      containers:
      - name: pi
        image: perl           # image is perl from docker   
        command: ["perl",  "-Mbignum=bpi", "-wle", "print bpi(2000)"]    # it calculates the first 2000 digits of pi number
      restartPolicy: Never   

image

  • Create job:

image

  • Watch pods' status:

image

  • Watch job's status:

image

  • After pods' completion, we can see the logs of each pods. Pods are not deleted after the completion of task on each pod.

image

  • Delete job:

image