apiVersion: apps/v1
kind: Deployment
metadata:
  name: redis
  labels:
    app: redis
spec:
  selector:
    matchLabels:
      app: redis
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: redis
    spec:
      volumes:
        - name: redis-persistent-volume
          persistentVolumeClaim:
            claimName: redis-pvc
        - name: redis-config-volume
          configMap:
            name: redis-config
      containers:
        - image: redis:4.0.11
          command: ['redis-server', '/usr/local/etc/redis/redis.conf']
          name: redis
          imagePullPolicy: Always
          resources:
            limits:
              cpu: 250m
              memory: 512Mi
            requests:
              cpu: 250m
              memory: 512Mi
          ports:
            - containerPort: 6379
              name: redis
          volumeMounts:
            - name: redis-persistent-volume
              mountPath: /data
            - name: redis-config-volume
              mountPath: /usr/local/etc/redis/redis.conf
              subPath: redis.conf
