apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: redis-app
spec:
  selector:
    matchLabels:
      app: redis-cluster-app
  serviceName: "redis-cluster-app"
  replicas: 6
  template:
    metadata:
      labels:
        app: redis-cluster-app
    spec:
      containers:
        - name: redis
          image: "redis:6.0.6"
          command:
            - "redis-server"
          args:
            - "/etc/redis/redis.conf"
            - "--protected-mode"
            - "no"
            - "--cluster-announce-ip"
            - "$(POD-IP)"
          ports:
            - name: redis
              containerPort: 6379
              protocol: "TCP"
            - name: cluster
              containerPort: 16379
              protocol: "TCP"
          volumeMounts:
            - name: "redis-conf"
              mountPath: "/etc/redis"
            - name: "redis-data"
              mountPath: "/var/lib/redis"
          env:
          - name: POD-IP
            valueFrom:
                fieldRef:
                  fieldPath: status.podIP
      volumes:
      - name: "redis-conf"
        configMap:
          name: "redis-cluster-conf"
          items:
            - key: "redis.conf"
              path: "redis.conf"
  volumeClaimTemplates:
    - metadata:
        name: redis-data
      spec:
        accessModes:
          - "ReadWriteOnce"
        storageClassName: standard
        resources:
          requests:
            storage: 200M



    