microk8s icon indicating copy to clipboard operation
microk8s copied to clipboard

prometheus ingress controller

Open KennethDhoe opened this issue 2 years ago • 5 comments

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?

KennethDhoe avatar Apr 20 '22 14:04 KennethDhoe

Hi @KennethDhoe, I haven't tried that. Have you looked at https://docs.nginx.com/nginx-ingress-controller/logging-and-monitoring/prometheus/ ?

ktsakalozos avatar Apr 26 '22 08:04 ktsakalozos

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!

KennethDhoe avatar May 04 '22 09:05 KennethDhoe

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.

fabioscaccabarozzi avatar Aug 25 '22 09:08 fabioscaccabarozzi

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

yunusefendi52 avatar Mar 18 '23 15:03 yunusefendi52

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.

stale[bot] avatar Feb 13 '24 01:02 stale[bot]