-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcron.yaml
63 lines (60 loc) · 1.35 KB
/
cron.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
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: jp-runner
rules:
- apiGroups:
- extensions
- apps
resources:
- deployments
verbs:
- 'get'
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: jp-runner
subjects:
- kind: ServiceAccount
name: sa-jp-runner
roleRef:
kind: Role
name: jp-runner
apiGroup: ""
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: sa-jp-runner
---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: available-pods-check
spec:
schedule: "*/5 * * * *"
successfulJobsHistoryLimit: 0
jobTemplate:
spec:
template:
spec:
serviceAccountName: sa-jp-runner
containers:
- name: available-pods-check
image: bitnami/kubectl:latest
env:
- name: CHANNEL
value: "#your-monitoring-channel"
- name: WEBHOOK
value: "https://hooks.slack.com/services/..."
command: ["/scripts/available-pods-check.sh"]
volumeMounts:
- name: available-pods-check
mountPath: /scripts
volumes:
- name: available-pods-check
configMap:
name: available-pods-check
defaultMode: 0777
restartPolicy: OnFailure