-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathredis-sentinel-statefulset.yaml
66 lines (66 loc) · 1.8 KB
/
redis-sentinel-statefulset.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
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: redis-sentinel
spec:
serviceName: redis-sentinel
replicas: 3
template:
metadata:
labels:
app: redis-sentinel
annotations:
pod.beta.kubernetes.io/init-containers: '[
{
"name": "init-redis",
"image": "library/redis:3.2",
"command": ["bash", "-c", "
set -ex\n
[[ `hostname` =~ -([0-9]+)$ ]] || exit 1\n
[[ -f /mnt/conf/sentinel.conf ]] && exit 0\n
# Copy appropriate conf.d files from config-map to emptyDir.\n
cp /mnt/config-map/sentinel.conf /mnt/conf/sentinel.conf\n
"],
"volumeMounts": [
{"name": "conf", "mountPath": "/mnt/conf"},
{"name": "config-map", "mountPath": "/mnt/config-map"}
]
}
]'
spec:
containers:
- name: redis-sentinel
command: ["redis-sentinel", "/etc/redis/sentinel.conf"]
image: library/redis:3.2
ports:
- name: redis-sentinel
containerPort: 26379
volumeMounts:
- name: conf
mountPath: /etc/redis
resources:
requests:
cpu: 100m
memory: 256Mi
readinessProbe:
exec:
command:
- sh
- -c
- "/usr/local/bin/redis-cli -h $(hostname) -p 26379 ping"
initialDelaySeconds: 15
timeoutSeconds: 5
volumes:
- name: config-map
configMap:
name: redis-sentinel
volumeClaimTemplates:
- metadata:
name: conf
annotations:
volume.alpha.kubernetes.io/storage-class: default
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 10Mi