apiVersion: apps/v1 
kind: StatefulSet
metadata:
  name: redis
spec:
  selector:
    matchLabels:
      app: redis
  replicas: 3
  serviceName: "redis"
  template:
    metadata:
      labels:
        app: redis
    spec:
      containers:
       - command: [sh, -c, source /redis-config/init.sh ]
         image: redis:4.0.11-alpine
         name: redis
         ports:
          - containerPort: 6379
            name: redis
         volumeMounts:
          - mountPath: /redis-config
            name: config
          - mountPath: /redis-data
            name: data
       - command: [sh, -c, source /redis-config-read-only/sentinel.sh]
         image: redis:4.0.11-alpine
         name: sentinel
         volumeMounts:
          - mountPath: /redis-config-read-only
            name: config
          - mountPath: /redis-config
            name: data
      volumes:
       - configMap:
           name: redis-config
         name: config
       - emptyDir: {}
         name: data
