Before getting started we need to make sure that we have the following tools installed.
Nginx Ingress Controller
Let’s install Nginx-Ingress Controller, Prometheus, Grafana with ***helm3***
helm repo add nginx-stable [https://helm.nginx.com/stable](https://helm.nginx.com/stable) helm repo update helm install controller nginx-stable/nginx-ingress --set prometheus.create=true --set prometheus.port=9901 helm install prometheus stable/prometheus helm install grafana stable/grafana
You can tweak the installation as per your needs, more details on this on https://docs.nginx.com/nginx-ingress-controller/installation/installation-with-helm/
One extra work that is needed is that we need to expose a service that listens to the port that contains the Nginx-Ingress-Controllers Prometheus Metrics in our case it's 9901.
Once we have created the service we now can go ahead and add the endpoints for Prometheus to scrape. We need to make sure although Prometheus is present inside of the Kubernetes cluster so that in the case easily resolves the internal Domains of the Nginx-ingress controller.
The next step is to use the above configuration as a Prometheus configuration. After which we can open Prometheus and head over the /targets page and verify if the ingress endpoints state is UP
To check what are the different types of metrics that Nginx Ingress Controller emits, we can head over to the Prometheus Dashboard and type in the console n*ginx. where *we receive a long list of different metrics that it emits.
Go ahead and add Prometheus as the data source in Grafana
Head over to Grafana Configuration > DataSource > Add Data Sources
Now, since we have added the Prometheus as a Datasource, we now need to added Dashboard for Nginx Ingress Controller. To make it less hassle-free there is already a Dashboard in place that gets everything set up with a few clicks.
We have now successfully able to set up Prometheus to scrape the metrics and Graphana to show the eye-catchy visualization for Nginx-Ingress-Controller.