Setting Up Prometheus and Grafana on EKS with ALB Ingress

Listen to this Post

Observability is critical for managing Kubernetes clusters, and Prometheus and Grafana are among the most popular open-source tools for monitoring and visualization. This guide walks through deploying them on Amazon EKS using Terraform and Helm, with ingress configured via an Application Load Balancer (ALB).

You Should Know:

1. Prerequisites

  • AWS CLI configured (aws configure)
    – `kubectl` installed
    – `helm` installed (sudo snap install helm --classic)
  • Terraform installed (sudo apt-get install terraform)

2. Initialize Terraform for EKS

terraform init
terraform plan -out eks_plan
terraform apply "eks_plan"

3. Install Prometheus via Helm

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm install prometheus prometheus-community/prometheus \
--namespace monitoring \
--set alertmanager.persistentVolume.storageClass="gp2" \
--set server.persistentVolume.storageClass="gp2"

4. Deploy Grafana

helm repo add grafana https://grafana.github.io/helm-charts
helm install grafana grafana/grafana \
--namespace monitoring \
--set persistence.storageClassName="gp2" \
--set service.type=LoadBalancer

5. Configure ALB Ingress

Create an `ingress.yaml` file:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: grafana-ingress
annotations:
kubernetes.io/ingress.class: alb
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/target-type: ip
spec:
rules:
- host: grafana.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: grafana
port:
number: 80

Apply it:

kubectl apply -f ingress.yaml -n monitoring

6. Access Grafana Dashboard

Retrieve the admin password:

kubectl get secret --namespace monitoring grafana -o jsonpath="{.data.admin-password}" | base64 --decode

Access via the ALB DNS name.

What Undercode Say

Monitoring Kubernetes with Prometheus and Grafana is essential for real-time insights. Key takeaways:
– Use Helm for simplified deployments.
– ALB ingress ensures secure external access.
– Persistent volumes (gp2) prevent data loss.
– Automate with Terraform for reproducibility.

Linux/IT Commands Used:

– `kubectl get pods -n monitoring` (Check deployments)
– `aws eks update-kubeconfig –name ` (Configure kubectl)
– `helm ls -n monitoring` (List installed charts)
– `terraform destroy` (Clean up resources)

Expected Output:

  • Prometheus scraping metrics at `http://prometheus-server.monitoring`
  • Grafana dashboard accessible via ALB URL (`http://grafana.example.com`)

Reference: Medium

References:

Reported By: Darryl Ruggles – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅

Join Our Cyber World:

💬 Whatsapp | 💬 TelegramFeatured Image