-
Notifications
You must be signed in to change notification settings - Fork 38
/
job.yaml
92 lines (90 loc) · 2.3 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
apiVersion: batch/v1
kind: Job
metadata:
name: example-job
spec:
backoffLimit: 1
template:
metadata:
labels:
app: example-job
spec:
restartPolicy: Never
volumes:
- name: graveyard
emptyDir:
medium: Memory
- name: kubexit
emptyDir: {}
initContainers:
- name: kubexit
image: karlkfi/kubexit:latest
command: ['cp', '/bin/kubexit', '/kubexit/kubexit']
volumeMounts:
- mountPath: /kubexit
name: kubexit
containers:
- name: client
image: alpine:3.11
command: ['sh', '-c']
args:
- |
set -o errexit -o nounset -o pipefail
apk --no-cache add ca-certificates tzdata curl bash
/kubexit/kubexit curl -v --fail http://localhost:80/
env:
- name: KUBEXIT_NAME
value: client
- name: KUBEXIT_GRAVEYARD
value: /graveyard
- name: KUBEXIT_BIRTH_DEPS
value: server
- name: KUBEXIT_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: KUBEXIT_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
volumeMounts:
- mountPath: /graveyard
name: graveyard
- mountPath: /kubexit
name: kubexit
- name: server
image: nginx:1.17-alpine
command: ['sh', '-c']
args:
- |
set -o errexit -o nounset -o pipefail
sleep 10
/kubexit/kubexit nginx -g 'daemon off;'
env:
- name: KUBEXIT_NAME
value: server
- name: KUBEXIT_GRAVEYARD
value: /graveyard
- name: KUBEXIT_DEATH_DEPS
value: client
volumeMounts:
- mountPath: /graveyard
name: graveyard
- mountPath: /kubexit
name: kubexit
livenessProbe:
tcpSocket:
port: 80
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 6
readinessProbe:
tcpSocket:
port: 80
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 6