microk8s
microk8s copied to clipboard
prometheus ingress controller
i want to collect data of the ingress controller provided by the microk8s enable ingress controller. however when i look in prometheus there is no service discovery for the ingress controller. Could this be implemented or could someone help me on the way to get this working?
Hi @KennethDhoe, I haven't tried that. Have you looked at https://docs.nginx.com/nginx-ingress-controller/logging-and-monitoring/prometheus/ ?
Hello, @ktsakalozos , Yes i have looked into this documentation however that did not resolve the issue. The issue lays in the ingress controller not exposing its metrics outside the pod. it is only reachable by localhost. thus prometheus cannot get the metrics needed for monitoring. Is that something that can be looked into for the ingress addon? thanks!
Hi @ktsakalozos , I noticed the same issue: we wanted to scrape the ingress metrics, but by default they are not annotated for Prometheus to scrape. I added to the deployment's spec.template.metadata the following:
...
metadata:
annotations:
prometheus.io/port: "10254"
prometheus.io/scrape: "true"
...
With this snippet, the metrics of nginx ingress pods are automatically picked up by Prometheus without further configuration.
just to add, I also added this to make sure nginx metrics is found, add to ports under this https://github.com/canonical/microk8s-core-addons/blob/69d8f85de732d09a669f9cf2dd946342d4bac7d1/addons/ingress/ingress.yaml#L249
- name: prometheus
containerPort: 10254
hostPort: 10255
And I use helm to install prometheus instead of microk8s helm install prometheus prometheus-community/prometheus
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.