-
Notifications
You must be signed in to change notification settings - Fork 53
/
cluster-permissions.yml
77 lines (72 loc) · 1.63 KB
/
cluster-permissions.yml
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
# example configuration with permission for running pod-reaper against
# an entire cluster
---
# namespace for the reaper
apiVersion: v1
kind: Namespace
metadata:
name: reaper
---
# service account for running pod-reaper
apiVersion: v1
kind: ServiceAccount
metadata:
name: pod-reaper-service-account
namespace: reaper
---
# minimal permissions required for running pod-reaper at cluster level
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: pod-reaper-cluster-role
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["list", "delete"]
---
# binding the above cluster role (permissions) to the above service account
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: pod-reaper-role-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: pod-reaper-cluster-role
subjects:
- kind: ServiceAccount
name: pod-reaper-service-account
namespace: reaper
---
# a basic pod-reaper deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: pod-reaper
namespace: reaper # namespace matches above
spec:
replicas: 1
selector:
matchLabels:
app: pod-reaper
template:
metadata:
labels:
app: pod-reaper
spec:
serviceAccount: pod-reaper-service-account # service account from above
containers:
- name: chaos
image: target/pod-reaper
resources:
limits:
cpu: 30m
memory: 30Mi
requests:
cpu: 20m
memory: 20Mi
env:
- name: SCHEDULE
value: "@every 15s"
- name: CHAOS_CHANCE
value: ".05"