# See https://github.com/kubernetes/examples/blob/master/guestbook/redis-master-deployment.yaml
apiVersion: apps/v1 #  for k8s versions before 1.9.0 use apps/v1beta2  and before 1.8.0 use extensions/v1beta1
kind: Deployment
metadata:
  name: redis-master
spec:
  selector:
    matchLabels:
      app: redis
      role: master
      tier: backend
  replicas: 8
  template:
    metadata:
      labels:
        app: redis
        role: master
        tier: backend
    spec:
      containers:
      - name: master
        image: redis:5.0  # or just image: redis
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
        ports:
        - containerPort: 30379
        command:
          - redis-server
          - "/redis-master/redis.conf"
        volumeMounts:
          - mountPath: /redis-master
            name: config
      nodeSelector:
        # kubectl get node --selector='!node-role.kubernetes.io/master'
        # magnum.openstack.org/role: "worker"
        is-minion: "true"
      hostNetwork: true
      dnsPolicy: ClusterFirstWithHostNet
      volumes:
        - name: config
          configMap:
            name: example-redis-config
            items:
            - key: redis-config
              path: redis.conf
