Skip to main content
Grafana does not store metrics itself; it visualizes metrics collected and stored elsewhere. To visualize metrics in Grafana you must configure a datasource that points to where those metrics live. In this demo we connect Grafana to a Prometheus instance running inside the cluster. Prerequisites
  • A Prometheus stack is installed in the monitoring namespace (kube-prometheus-stack or similar).
  • Grafana is running and reachable (exposed via NodePort in this environment).
  • kubectl configured to access the cluster.
Verify pods and services Run the following to confirm the Prometheus and Grafana components are running:
A sample output looks like:
Quick summary of important endpoints Open Grafana and log in Use the Grafana NodePort (or your configured ingress) to reach the Grafana UI and sign in with the credentials for your setup.
The image shows a Grafana login screen with fields for email or username and password against a gradient background. The "Log in" button is prominently displayed below the input fields.
After login you will arrive at Grafana’s home/dashboard page where you can add data sources and create dashboards.
The image shows the Grafana dashboard interface, featuring a welcome message and options for setting up data sources and creating dashboards. There are also links for help and recent blog updates.
Add Prometheus as a data source
  1. Click Add your first data source (or Add data source).
  2. From the list, choose Prometheus.
The image shows a Grafana interface with options to add different data sources, including Prometheus, Graphite, InfluxDB, and others. It is organized under categories like time series databases and logging & document databases.
Configure the Prometheus connection
  • Keep the default Name (or give it a descriptive name such as prometheus-monitoring).
  • For the URL, point Grafana to the in-cluster Prometheus service. Use the full service DNS name and port (including scheme):
This follows the standard in-cluster DNS pattern: service-name.namespace.svc.cluster.local:port It will work regardless of the namespace where Grafana runs, provided DNS resolves and any network policies allow access.
The image shows the Grafana interface for configuring a Prometheus data source, including fields for connection settings and authentication methods.
Optional settings
  • Toggle “Default” if you want this Prometheus instance to be the default for new dashboards.
  • Leave authentication, timeouts, and other advanced settings at their defaults unless you require custom configuration (e.g., TLS, headers, or proxy).
Save and test Click Save & Test. On success Grafana will show a green confirmation that it was able to query the Prometheus API.
The image shows a Grafana data source configuration screen for Prometheus, with various settings toggles and input fields for performance and connection parameters. There's a notification indicating successful querying of the Prometheus API.
If Save & Test fails, verify the following:
  • The service DNS and port are correct: http://prometheus-operated.monitoring.svc.cluster.local:9090.
  • Prometheus pods are running in the monitoring namespace: kubectl get pods -n monitoring.
  • NetworkPolicies, firewall rules, or cluster network ACLs are not preventing in-cluster requests from Grafana to Prometheus.
Next steps
  • Create dashboards and panels that query Prometheus using PromQL.
  • Import prebuilt Grafana dashboards for Kubernetes or your applications.
  • Secure access to Grafana (authentication, RBAC, and TLS) before exposing it externally.
Links and references

Watch Video