Can I use two Haproxy ingress controller in two different namespaces in the same cluster?

5/30/2019

If I have deployments for two haproxy ingress controllers in two different namespaces on the same cluster, but the functionality of haproxy ingress controller is misbehaving. I just wanted to know if I can create two haproxy deployments in two namespaces and use them effortlessly?

-- namrata
kubernetes

1 Answer

6/26/2019

Yes, you can. In order to achieve this you should use correctly configured RBAC and --namespace-whitelist flag to point to correct namespace.

HAProxy documentation says you can whitelist/blacklist namespaces HAProxy uses:

--namespace-whitelist

The controller watches all namespaces, but you can specify a specific namespace to watch. You can specify this setting multiple times.

--namespace-blacklist

The controller watches all namespaces, but you can blacklist a namespace that you do not want to watch for changes. You can specify this setting multiple times.

You can customize the ingress controller Deployment resource in the file haproxy-ingress.yaml in the repository https://github.com/haproxytech/ by adding any of the following arguments under the section spec.template.spec.containers.args

You deployments should look like

spec:
      serviceAccountName: haproxy-ingress-service-account
      containers:
      - name: haproxy-ingress
        image: haproxytech/kubernetes-ingress
        args:
          - --default-ssl-certificate=default/tls-secret
          - --configmap=default/haproxy-configmap
          - --default-backend-service=haproxy-controller/ingress-default-backend
          - --namespace-whitelist=mynamespace1
-- VKR
Source: StackOverflow