Introduction
Monitoring Kubernetes clusters is not optional in modern DevOps environments—it is a critical requirement for ensuring application reliability, performance, and scalability.
In real-world production systems, simply installing monitoring tools is not enough. You must verify metric collection, visualize meaningful data, configure intelligent alerts, and handle scaling challenges such as storage and metric explosion.
Prometheus and Grafana together form a powerful, industry-standard monitoring stack:
Prometheus collects and stores metrics
Grafana visualizes those metrics through dashboards
This guide goes beyond basics and shows how to set up, verify, troubleshoot, and optimize Kubernetes monitoring in a production-ready way.
What is Kubernetes Monitoring?
Kubernetes monitoring involves tracking cluster health, performance, and resource usage in real time.
This includes:
CPU and memory usage
Pod health and restart counts
Node performance
Network traffic and latency
Without proper monitoring, identifying issues like memory leaks, node failures, or slow APIs becomes extremely difficult.
Installing Prometheus and Grafana Using Helm
Step 1: Add Helm Repository
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
Step 2: Install kube-prometheus-stack
helm install monitoring prometheus-community/kube-prometheus-stack -n monitoring --create-namespace
Expected Output (Example)
NAME: monitoring
LAST DEPLOYED: <timestamp>
NAMESPACE: monitoring
STATUS: deployed
NOTES:
Visit Grafana at http://localhost:3000
Verifying Installation (Critical Step)
Check Pods
kubectl get pods -n monitoring
Expected:
monitoring-kube-prometheus-prometheus-0 2/2 Running
monitoring-grafana-xxxxx 3/3 Running
monitoring-alertmanager-0 2/2 Running
Check Services
kubectl get svc -n monitoring
Port Forward Grafana
kubectl port-forward svc/monitoring-grafana -n monitoring 3000:80
Access: http://localhost:3000
Default credentials:
Username: admin
Password: prom-operator
Verify Prometheus is Scraping Metrics
Port-forward Prometheus:
kubectl port-forward svc/monitoring-kube-prometheus-prometheus -n monitoring 9090
Open: http://localhost:9090/targets
You should see targets with status:
UP → working correctly
DOWN → needs troubleshooting
Real PromQL Examples (Must-Know)
CPU Usage Per Node
sum(rate(node_cpu_seconds_total{mode!="idle"}[5m])) by (instance)
Pod Restart Count
increase(kube_pod_container_status_restarts_total[10m])
Join the conversation! Your thoughts help the community grow.