-
Notifications
You must be signed in to change notification settings - Fork 0
/
redis.yaml
97 lines (97 loc) · 2 KB
/
redis.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
apiVersion: v1
kind: Service
metadata:
name: redis-hs
labels:
app: redis
spec:
type: ClusterIP
clusterIP: None
ports:
- name: redis
port: 6379
targetPort: 6379
selector:
app: redis
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: redis
spec:
selector:
matchLabels:
app: redis
serviceName: redis-hs
replicas: 6
updateStrategy:
type: RollingUpdate
podManagementPolicy: OrderedReady
template:
metadata:
labels:
app: redis
spec:
serviceAccountName: redis
securityContext:
fsGroup: 1000
containers:
- name: redis-container
imagePullPolicy: IfNotPresent
image: fwt11/redis-k8s
command:
- sh
- -c
- |
HOST=$(hostname)
mkdir -p /data/redis/$HOST && cd /data/redis/$HOST
genconf&
sleep 1
until [ -f /etc/redis/redis.conf ]
do
sleep 1
done
redis-server /etc/redis/redis.conf
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
ports:
- containerPort: 6379
name: redis
volumeMounts:
- name: host-time
mountPath: /etc/localtime
- name: data-dir
mountPath: /data/redis
- name: config
mountPath: /etc/redis
- name: gen-conf
mountPath: /usr/local/bin/genconf
subPath: genconf-redis
volumes:
- name: host-time
hostPath:
path: /etc/localtime
- name: config
emptyDir: {}
- name: data-dir
persistentVolumeClaim:
claimName: data-dir
- name: gen-conf
configMap:
name: gen-conf
defaultMode: 0755
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: data-dir
labels:
name: redis-pvc
spec:
accessModes: ["ReadWriteMany"]
resources:
requests:
storage: 1Gi