apiVersion: apps/v1
kind: Deployment
metadata:
  name: varnish
  namespace: cafe
spec:
  replicas: 2
  selector:
    matchLabels:
      app: varnish-ingress
  template:
    metadata:
      labels:
        app: varnish-ingress
    spec:
      containers:
      - image: varnish-ingress/varnish
        imagePullPolicy: IfNotPresent
        name: varnish-ingress
        ports:
        - name: http
          containerPort: 80
        - name: k8s
          containerPort: 8080
        - name: varnishadm
          containerPort: 6081
        volumeMounts:
        - name: adm-secret
          mountPath: "/var/run/varnish"
          readOnly: true
        - name: varnish-home
          mountPath: "/var/run/varnish-home"
        livenessProbe:
          exec:
            command:
            - /usr/bin/pgrep
            - -P
            - "0"
            - varnishd
        readinessProbe:
          httpGet:
            path: /ready
            port: k8s
        args:
          - -n
          - /var/run/varnish-home
      volumes:
      - name: adm-secret
        secret:
          secretName: adm-secret
          items:
          - key: admin
            path: _.secret
      - name: varnish-home
        emptyDir:
          medium: "Memory"
