Skip to main content

Grafana

Grafana is an open-source visualisation platform that queries data sources such as Prometheus and renders dashboards and alerts. In Kubernetes it turns raw PromQL results into charts that make cluster and application health readable at a glance.

What Grafana does

Prometheus stores metrics but its UI is built for queries, not for team-wide situational awareness. Grafana queries Prometheus (and Loki, Tempo, CloudWatch and others), then displays panels on dashboards that refresh automatically. Grafana does not store the metrics itself.

flowchart TD P["Prometheus
stores metrics"] -->|"PromQL results"| G["Grafana
dashboards"] L["Loki logs"] -->|"log queries"| G G --> E["Engineers"] G -->|"alert rules"| N["Notifications"] classDef src fill:#FFEDD5,color:#1E293B classDef app fill:#326CE5,color:#ffffff classDef out fill:#D1FAE5,color:#1E293B class P,L src class G app class E,N out

Installing with kube-prometheus-stack

Bash
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm install kube-prometheus-stack prometheus-community/kube-prometheus-stack \
--namespace monitoring --create-namespace \
--set grafana.persistence.enabled=true \
--set grafana.persistence.size=10Gi \
--set grafana.admin.existingSecret=grafana-admin
kubectl port-forward svc/kube-prometheus-stack-grafana 3000:80 -n monitoring

Create the admin credentials as a Kubernetes Secret rather than putting a password on the command line.

Useful starter dashboards

Import community dashboards by ID under Dashboards then Import. Popular ones cover cluster overview, pod resources, Node Exporter, and deployments. Check each dashboard's compatibility with your Prometheus labels before relying on it.

Dashboard concepts

Concept Meaning
Panel A single chart, gauge, or table
Variable A dropdown that filters every panel, such as namespace
Annotation A marker for deploys or incidents
Data source Where queries run

Variables keep dashboards reusable

TEXT
Variable name: namespace
Query: label_values(kube_pod_info, namespace)
Panel query: rate(http_requests_total{namespace="$namespace"}[5m])
Tip

Organise dashboards in folders per team and link the main one in the runbook so on-call engineers find it in seconds.

Security

Do not share the admin login. Connect Grafana to SSO and give people viewer or editor roles.

Common Mistake

One dashboard for every environment without a namespace or cluster variable. Engineers end up reading staging metrics during a production incident.

Frequently Asked Questions

Why pair Grafana with Prometheus?

Prometheus collects and stores metrics and evaluates alert rules, while Grafana visualises data from many backends. They solve different problems and are designed to work together.

Can Grafana send alerts on its own?

Yes, Grafana has its own alerting. Many teams still define alert rules in Prometheus and route them through Alertmanager, and choose one place to avoid duplicate alerts.

How do I stop dashboards breaking when workloads are renamed?

Use template variables populated from label queries instead of hardcoded namespace or pod names.

Found a mistake, an outdated step or a broken link?