Addition of a configuration to HAProxy Ingress Controller not working

8/15/2019

I have the below config that I need to add to the HA Proxy Ingress controller on my k8s.

acl metrics path -i /metrics
use_backend httpback-default-backend if metrics

So basically what I want is that for all Ingress hosts (URLs) being accessed using the controller, if the path /metrics is accessed, the request needs to be routed to the Ingress default backend and the user should get a 404 error.

So in my standard HA Proxy deployment I have the following configMaps

k get cm
NAME                                DATA   AGE
haproxy-configmap                   8      50d
haproxy-configmap-tcpservice        1      50d
haproxy-ingress                     0      50d
ingress-controller-leader-haproxy   0      50d

And Ive added my config to the haproxy-configmap configMap in the config-frontend section

apiVersion: v1
data:
  config-frontend: |
    capture request header Host len 32
    capture request header X-Request-ID len 64
    capture request header User-Agent len 200
    acl metrics path -i /metrics
    use_backend httpback-default-backend if metrics

Now I expect that /metrics endpoint should lead me to a 404 error but seems like I can still access it.

What am I missing here ?

-- Jason Stanley
haproxy
haproxy-ingress
kubernetes-ingress

0 Answers