DEV Community

Celso Nery
Celso Nery

Posted on

Kubernetes: Visualizing Metrics with Grafana

🇧🇷 Leia a versão em português aqui...

Prometheus (covered in the previous article of this addons series) is great for collecting and storing metrics, but its native interface is quite limited for visualization. That's where Grafana comes in: the most widely used tool for turning data collected by Prometheus into visual dashboards, with charts, alerts, and customizable panels.

Prerequisites

Before installing Grafana, you should already have in the cluster:

  • Metrics Server installed and working;
  • Prometheus installed (it's the data source Grafana will query);
  • Helm installed.

Installing Grafana via Helm

Like Prometheus, Grafana is also available as a chart on Artifact Hub.

Add the official repository and update the chart list:

helm repo add grafana https://grafana.github.io/helm-charts
helm repo update
Enter fullscreen mode Exit fullscreen mode

And install the chart (using default values, or exporting and customizing a values.yaml, the same way we did with Prometheus):

helm install grafana grafana/grafana
Enter fullscreen mode Exit fullscreen mode

Accessing Grafana

Depending on how the Service was exposed (for example, via NodePort), Grafana becomes accessible at a URL like:

https://adm.bagarote.com.br:30002
Enter fullscreen mode Exit fullscreen mode

Address and port are just examples — adjust to what's configured in your environment.

For reference and more in-depth documentation on Grafana's features:

🔗 https://grafana.com/

Resetting the administrator password

If you lose access to the default admin account, you can reset the password directly via the command line, inside the Grafana pod:

grafana-cli admin reset-admin-password --password-from-stdin
Enter fullscreen mode Exit fullscreen mode

This command reads the new password from standard input (stdin) — normally run inside the pod (via kubectl exec), piping the new password in.

Connecting Prometheus as a data source

With Grafana up, the next step is configuring Prometheus as a data source, so dashboards can query the collected metrics. This is done through Grafana's web interface (under Configuration → Data Sources), providing the internal URL of the Prometheus service inside the cluster:

http://prometheus-service:8080
Enter fullscreen mode Exit fullscreen mode

Or, depending on how internal DNS is configured, an externally accessible address:

http://metrics.bagarote.com.br
Enter fullscreen mode Exit fullscreen mode

The correct address depends on the name of the Prometheus Service created by the Helm chart and its namespace — use kubectl get svc to confirm the exact name and port in your cluster.

Importing ready-made dashboards

Instead of building dashboards from scratch, Grafana lets you import ready-made templates shared by the community, through a dashboard ID, directly from the grafana.com/dashboards page. Two examples used in this environment:

  • Dashboard 9679
  • Dashboard 10000

To import: in Grafana's interface, go to Dashboards → New → Import, enter the desired dashboard ID, select Prometheus as the data source, and confirm.

Since community dashboard IDs can be updated, renamed, or even removed over time, it's worth checking directly on grafana.com/dashboards for the exact content of each one before importing them into a new environment.

Final thoughts

With Grafana connected to Prometheus and dashboards imported, the cluster now has a complete visual observability layer — allowing you to track node and application behavior in real time, without needing to interpret raw metrics data. From here, it's worth exploring alerting configuration within Grafana itself, automatically notifying you whenever a metric falls outside the expected range (CPU usage, application errors, etc.).

Top comments (0)