I have two ingress controllers (for public/internal traffic), what I would like is for all endpoints to use the public ingress except for /metrics, which should be internal, all using the same host.
E.g.
example.com/ -> public ingress
example.com/metrics -> internal ingress
This is what I have tried:
internal ingress
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: example-metrics-ingress
annotations:
kubernetes.io/ingress.class: ingress-internal
spec:
rules:
- host: example.com
http:
paths:
- path: /metrics
backend:
serviceName: example-servicename
servicePort: 80
and public ingress
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: example-ingress
annotations:
kubernetes.io/ingress.class: nginx
spec:
rules:
- host: example.com
http:
paths:
- path:
backend:
serviceName: example-servicename
servicePort: 80
The internal ingress is currently being ignored when I visit example.com/metrics (it uses the public one instead).
If I change the internal ingress to use the same ingress controller as the public one and change the service port to 81 (as an example), this provides an error (which is expected), this shows that the two different ingresses are being used. However, as soon as I use two different ingress controllers, then the one ingress' rules are not being picked up.
How can I configure my ingresses to achieve my desired result?