apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
  name: redis-master
  labels:
    app: redis
spec:
  selector:
    matchLabels:
      app: redis
      role: master
      tier: backend
  replicas: 1
  template:
    metadata:
      labels:
        app: redis
        role: master
        tier: backend
    spec:
      containers:
        - name: master
          image: k8s.gcr.io/redis:e2e # or just image: redis
          command:
            - redis-server
            - "/redis-master/redis.conf"
          env:
            - name: MASTER
              value: "true"
          volumeMounts:
            - mountPath: /redis-master
              name: config
          resources:
            requests:
              cpu: 100m
              memory: 100Mi
            limits:
              cpu: 250m
              memory: 256Mi
          ports:
            - containerPort: 6379
      volumes:
        - name: config
          configMap:
            name: example-redis-config
            items:
              - key: redis-config
                path: redis.conf
