apiVersion: v1
kind: ReplicationController
metadata:
  name: service-loadbalancer
  labels:
    app: service-loadbalancer
    version: v1
spec:
  replicas: 1
  selector:
    app: service-loadbalancer
    version: v1
  template:
    metadata:
      labels:
        app: service-loadbalancer
        version: v1
    spec:
      nodeSelector:
        role: loadbalancer
      volumes:
      - name: haproxy-secrets-volume
        secret:
          secretName: haproxy-secrets-volume
      containers:
      - image: quay.io/pulsecode/kubernetes-haproxy
        imagePullPolicy: Always
        livenessProbe:
          httpGet:
            path: /healthz
            port: 8081
            scheme: HTTP
          initialDelaySeconds: 30
          timeoutSeconds: 5
        name: haproxy
        ports:
        # All http services
        - containerPort: 80
          hostPort: 80
          protocol: TCP
        - containerPort: 443
          hostPort: 443
          protocol: TCP
        # haproxy stats
        - containerPort: 1936
          hostPort: 1936
          protocol: TCP
        volumeMounts:
        - mountPath: /etc/haproxy/certs.d/
          name: haproxy-secrets-volume
        args:
        - --stats-ssl-cert=/etc/haproxy/certs.d/stats.pem
        - --stats-username=/etc/haproxy/certs.d/stats-username
        - --stats-password=/etc/haproxy/certs.d/stats-password
        - --default-ssl-cert=/etc/haproxy/certs.d/default.pem
