-
Notifications
You must be signed in to change notification settings - Fork 2
/
redis-north.yaml
109 lines (109 loc) · 3.06 KB
/
redis-north.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-server
labels:
name: redis-server
spec:
replicas: 1
selector:
matchLabels:
name: redis-server
template:
metadata:
labels:
name: redis-server
application: redis-server
app.kubernetes.io/part-of: redis
spec:
subdomain: primary
containers:
- name: redis
image: redis
command:
- "redis-server"
args:
- "--replica-announce-ip"
- "redis-server-north"
- "--protected-mode"
- "no"
ports:
- containerPort: 6379
volumeMounts:
- mountPath: /data
name: redis-data
volumes:
- name: redis-data
emptyDir: {}
---
kind: ConfigMap
apiVersion: v1
metadata:
name: redis
data:
sentinel.conf: |-
sentinel resolve-hostnames yes
sentinel announce-hostnames yes
sentinel monitor redis-skupper redis-server-north 6379 2
sentinel down-after-milliseconds redis-skupper 5000
sentinel failover-timeout redis-skupper 10000
sentinel parallel-syncs redis-skupper 1
sentinel announce-ip redis-sentinel-north
sentinel announce-port 26379
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-sentinel
labels:
name: redis-sentinal
spec:
replicas: 1
selector:
matchLabels:
name: redis-sentinal
template:
metadata:
labels:
name: redis-sentinal
application: redis-sentinel
app.kubernetes.io/part-of: redis-sentinel
spec:
containers:
- name: redis-sentinel
image: redis
command:
- "redis-server"
args:
- "/etc/redis/sentinel.conf"
- "--sentinel"
ports:
- containerPort: 26379
name: redis-sentinel
volumeMounts:
- name: redis-data
mountPath: /etc/redis
initContainers:
- name: init-conf
image: alpine
command: ['sh', '-c', "cp /config/sentinel.conf /data"]
volumeMounts:
- name: redis-data
mountPath: /data
- name: redis-config
mountPath: /config
- name: init-waitforsvc-north
image: alpine
command: ['sh', '-c', "until nslookup redis-server-north.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for redis a instance; sleep 2; done"]
- name: init-waitforsvc-west
image: alpine
command: ['sh', '-c', "until nslookup redis-server-west.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for redis b instance; sleep 2; done"]
- name: init-waitforsvc-east
image: alpine
command: ['sh', '-c', "until nslookup redis-server-east.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for redis c instance; sleep 2; done"]
volumes:
- name: redis-config
configMap:
name: redis
- name: redis-data
emptyDir: {}