apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: mailu-redis
  namespace: mailu-mailserver
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: mailu-redis
        role: mail
        tier: backend
    spec:
      containers:
      - name: redis
        image: redis:4.0-alpine
        imagePullPolicy: Always
        volumeMounts:
          - mountPath: /data
            name: redisdata
        ports:
          - containerPort: 6379
            name: redis
            protocol: TCP
        resources:
          requests:
            memory: 200Mi
            cpu: 100m
          limits:
            memory: 300Mi
            cpu: 200m
      volumes:
        - name: redisdata
          persistentVolumeClaim:
            claimName: redis-hdd
---

apiVersion: v1
kind: Service
metadata:
  name: redis
  namespace: mailu-mailserver
  labels:
    app: mailu-redis
    role: mail
    tier: backend
spec:
  selector:
    app: mailu-redis
    role: mail
    tier: backend
  ports:
  - name: redis
    port: 6379
    protocol: TCP