JOB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

apiVersion: batch/v1
kind: Job
metadata:
name: echo-job

spec:
template:
spec:
restartPolicy: OnFailure
containers:
- image: busybox
name: echo-job
imagePullPolicy: IfNotPresent
command: ["/bin/echo"]
args: ["hello", "world"]

CORN JOB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

apiVersion: batch/v1
kind: Job
metadata:
name: sleep-job

spec:
activeDeadlineSeconds: 15
backoffLimit: 2
completions: 4
parallelism: 2

template:
spec:
restartPolicy: OnFailure
containers:
- image: busybox
name: echo-job
imagePullPolicy: IfNotPresent
command:
- sh
- -c
- sleep $(($RANDOM % 10 + 1)) && echo done