I have two separate IngressControllers, one internal and one external. I would like to define which controller to use for each Ingress.
I have defined --ingress.class=hapxroxy-ext
arg for the external controller and --empty-ingress-class
for the internal.
Ingress Services
apiVersion: v1
kind: Service
metadata:
annotations:
labels:
run: ext-haproxy-ingress
name: ext-haproxy-ingress
namespace: ext-haproxy-controller
spec:
selector:
run: ext-haproxy-ingress
type: LoadBalancer
---
apiVersion: v1
kind: Service
metadata:
annotations:
"service.beta.kubernetes.io/azure-load-balancer-internal": "true"
labels:
run: haproxy-ingress
name: haproxy-ingress
namespace: haproxy-controller
spec:
selector:
run: haproxy-ingress
type: LoadBalancer
I have IngressClasses.
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
name: external-lb
spec:
controller: haproxy.org/ingress-controller/hapxroxy-ext
---
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
name: internal-lb
annotations:
"ingressclass.kubernetes.io/is-default-class": "true"
spec:
controller: haproxy.org/ingress-controller
I have one Ingress
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress
annotations:
"kubernetes.io/ingress.class": internal-lb
spec:
ingressClassName: internal-lb
...
Despite mapping the Ingress to just internal-lb
, both internal-lb
and external-lb
handle requests.
It seems pretty straightforward in the docs, but I'm missing something.
This issue is due to a bug in https://github.com/haproxytech/kubernetes-ingress when using IngressClassName in ingress.yaml. If you remove IngressClassName from your ingress.yaml and just use "kubernetes.io/ingress.class": annotation the issue goes away, it more of a workaround than a fix.
This issue has been raised and still open see link below for updates.
https://github.com/haproxytech/kubernetes-ingress/issues/354#issuecomment-904551220