apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: redis-master
spec:
  selector:
    matchLabels:
      app: redis-master
  serviceName: redis-master
  template:
    metadata:
      labels:
        app: redis-master
    spec:
      containers:
        - name: redis
          image: redis:6.2.6
          imagePullPolicy: IfNotPresent
          command:
            - sh
          args:
            - -c
            - redis-server /usr/local/etc/redis/redis.conf
          ports:
            - containerPort: 6379
              name: masterport
              protocol: TCP
          volumeMounts:
            - mountPath: /usr/local/etc/redis
              name: conf
      volumes:
        - name: conf
          configMap:
            name: redis-config
            items:
              - key: master.conf
                path: redis.conf
