DEV Community

Cover image for Monitor and Visualize Nginx Ingress Controller Metrics on Amazon EKS with Prometheus & Grafana

Monitor and Visualize Nginx Ingress Controller Metrics on Amazon EKS with Prometheus & Grafana

In today’s digital landscape, it is very necessary to figure out trends in our data and act accordingly to ensure high availability of our application. Monitoring helps us to stay on top of the game and get insights on our product environment. An Ingress Controller acts as a bridge between Kubernetes Service and the external world and can be considered as a specialized load balancer for Kubernetes.


  1. A Kubernetes Cluster (Create an EKS Cluster from scratch)
  2. Helm V3 (Helm Install Docs)

Install Kube-Prometheus-Stack using Helm

helm repo add prometheus-community 
helm repo update 
helm install --create-namespace --namespace monitoring \
my-k8s-prom-stack prometheus-community/kube-prometheus-stack
Enter fullscreen mode Exit fullscreen mode

Once you have the stack installed you should have Prometheus, Grafana and AlertManager installed onto your cluster.

Kube Prometheus Stack

Install Nginx Ingress Controller

helm repo add ingress-nginx 
helm repo update 
helm install ingress-nginx ingress-nginx/ingress-nginx \
--namespace ingress-nginx --create-namespace \
--set controller.metrics.enabled=true \
--set controller.metrics.serviceMonitor.enabled=true \
--set controller.metrics.serviceMonitor.additionalLabels.release="my-k8s-prom-stack" \
Enter fullscreen mode Exit fullscreen mode

Along with installing the ingress controller we are setting the controller metrics as true which will populate an additional metrics service and creating a service monitor for that service which will feed data onto Prometheus, the additional Label would be as per the selector you have set on the Prometheus Operator, follow the later part for more details on this.

You can check the Service Monitor selector on your Prometheus Operator using:

kubectl get prometheus --namespace monitoring prometheus-svc-name –oyaml (lookout for the section below on the manifest)

Service Monitor Selector on Prom Operator

Once Nginx controller is installed you can verify the services that are spawned using:

kubectl get svc --namespace ingress-nginx

Ingress Controller Services

Service Monitor

Monitor and Visualize Nginx Controller Metrics

To access the Prometheus and Grafana you can set ingress objects
Sample Ingress Manifest:

kind: Ingress
  annotations: nginx 5m  
  name: prometheus-ingress
  namespace: monitoring
  - host:
      - backend:
            name: my-k8s-prom-stack-kube-pro-prometheus
              number: 9090
        path: /
        pathType: ImplementationSpecific
Enter fullscreen mode Exit fullscreen mode

Generate some load on the Ingress Controller by hitting the Ingress Endpoints.

Access Prometheus and Grafana to query and visualize the controller metrics:
Prometheus Console
Prom Query to check the number of 200 requests on ingress:

Prom Console

Import Nginx Controller Dashboard on Grafana and visualize the metrics (Dashboard ID: 9614)

Grafana Dashboard

Thank you for reading this, you can follow me for more such content, or reach out to me on Linkedin.

Top comments (0)