-
Notifications
You must be signed in to change notification settings - Fork 0
/
job.yaml
51 lines (51 loc) · 1005 Bytes
/
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
apiVersion: v1
kind: Namespace
metadata:
name: pod-restarter
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: pod-restarter
namespace: pod-restarter
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: pod-restarter
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["list", "delete"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: pod-restarter
subjects:
- kind: ServiceAccount
name: pod-restarter
namespace: pod-restarter
roleRef:
kind: ClusterRole
name: pod-restarter
apiGroup: rbac.authorization.k8s.io
---
apiVersion: batch/v1
kind: Job
metadata:
name: pod-restarter
namespace: pod-restarter
spec:
template:
spec:
serviceAccountName: pod-restarter
containers:
- name: pod-restarter
image: oneoneonepig/pod-restarter:0.3`
args:
- -namespace=default
- -grace-period=10
- -selector=app=nginx
restartPolicy: Never
backoffLimit: 3