-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsample-redis-pod-labeler-deployment.yaml
88 lines (88 loc) · 2.44 KB
/
sample-redis-pod-labeler-deployment.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
# Here we create service-account/role and binding to access namespace and pods
# and Deployment uses the created service account
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: redis-pod-labeler
name: redis-pod-labeler-service-account
namespace: redis
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: redis-pod-labeler-role
namespace: redis
rules:
- apiGroups: [""]
resources: ["namespaces", "pods"]
verbs: ["get", "patch", "list"]
- apiGroups: [""]
resources: ["services"]
verbs: ["get", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: redis-pod-labeler-rolebinding
namespace: redis
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: redis-pod-labeler-role
subjects:
- kind: ServiceAccount
name: redis-pod-labeler-service-account
namespace: redis
---
kind: Deployment
apiVersion: apps/v1
metadata:
labels:
app: redis-pod-labeler
name: redis-pod-labeler
namespace: redis
spec:
replicas: 1
revisionHistoryLimit: 5
selector:
matchLabels:
app: redis-pod-labeler
template:
metadata:
labels:
app: redis-pod-labeler
spec:
containers:
- name: redis-pod-labeler
imagePullPolicy: Always
image: "hmdmph/redis-pod-labeler:1.0.0"
args:
- ./redis-labeler.py
- --namespace=redis # namespace which deployed redis
- --pod-selector=app=redis-ha # key=value of to match and get the redis pods (here app=redis-ha)
- --update-period=60 # how frequent labelling should happen( default to 60 seconds = 1 minute )
- --redis-cluster-name=mymaster # redis cluster name
- --redis-headless-svc-name=redis-ha # redis headless service name
#- --verbose # if u want to see more detailed output
livenessProbe:
exec:
command:
- /bin/sh
- -c
- ps uaxw | egrep 'python' | grep -v 'grep'
readinessProbe:
exec:
command:
- /bin/sh
- -c
- ps uaxw | egrep 'python' | grep -v 'grep'
resources:
limits:
cpu: 300m
memory: 300Mi
requests:
cpu: 100m
memory: 100Mi
serviceAccountName: redis-pod-labeler-service-account