forked from HariSekhon/Kubernetes-configs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjob.yaml
70 lines (66 loc) · 2.05 KB
/
job.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#
# Author: Hari Sekhon
# Date: [% DATE # 2019-11-28 18:51:59 +0000 (Thu, 28 Nov 2019) %]
#
# vim:ts=2:sts=2:sw=2:et
# lint: k8s
#
# https://github.com/HariSekhon/Kubernetes-configs
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn
# and optionally send me feedback to help improve or steer this or other code I publish
#
# https://www.linkedin.com/in/HariSekhon
#
# ============================================================================ #
# J o b
# ============================================================================ #
# https://kubernetes.io/docs/concepts/workloads/controllers/job/
# https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/job-v1/
---
apiVersion: batch/v1
kind: Job
metadata:
name: NAME
namespace: NAMESPACE
#annotations:
# datree.skip/CONTAINERS_MISSING_READINESSPROBE_KEY: readiness probe is not relevant for this cronjob
# datree.skip/CONTAINERS_MISSING_LIVENESSPROBE_KEY: liveness probe is not relevant for this cronjob
spec:
completions: 8 # total successful jobs - omit this for queue pattern where any pod successfully finishes
parallelism: 4 # concurrent jobs
template:
metadata:
name: NAME
spec:
restartPolicy: Never
containers:
- name: NAME
image: perl
# takes about a minute to execute
command:
- perl
args:
- -Mbignum=bpi
- -wle
- print bpi(2000)
readinessProbe:
exec:
command:
- pgrep -f perl
livenessProbe:
exec:
command:
- pgrep -f perl
resources:
requests:
cpu: 300m
memory: 300Mi
limits:
cpu: "1"
memory: 1Gi
# exponential backoff retries of job - 10 => 20 => 40 secs...
backoffLimit: 6 # default, max job retries
activeDeadlineSeconds: 300 # max job runtime