I’ve been using both Kube-Prometheus-Stack and Ingress-Nginx helm charts. I tried following this guide in the official docs and it did help getting the Ingress target and some of its metrics like in the picture below but it’s missing some the metrics that are specified in the Ingress docs like nginx_ingress_controller_requests
which I’m trying to use in order to monitor Nginx’s status codes metrics. Everything is configured as said in the guide i mentioned earlier. Below are the currently available metrics. Does anyone know what’s missing?
2
Answers
I found the solution. According to this github issue, all that's needed is to add the following arg to the Ingress Nginx deployment:
--metrics-per-host=false
The
nginx_ingress_controller_requests
metric won’t appear until you make at least one request to an ingress resource. This is expected behavior – the metric only gets created after the first request comes through.To fix this, you have two options:
--metrics-per-host=false
argument to your ingress-nginx deployment.The second option is recommended if you want the metrics to appear immediately, though note that you’ll lose per-host labeling and only have per-ingress labels.
Note: When using wildcard ingresses, metrics are disabled by default to prevent cardinality explosion. If you need metrics for wildcard ingresses, you can enable them with:
Just be aware this may significantly increase the number of metrics.