Grafana is an open-source visualization and observability platform. It helps engineers query, visualize, analyze, and alert on operational data using dashboards.
Grafana can connect to data sources such as:
- Prometheus
- AWS CloudWatch
- Azure Monitor
- Elasticsearch
- PostgreSQL
- MySQL
- Loki
The original notes correctly identify dashboards, multiple data sources, Kubernetes monitoring, and Helm deployment as Grafana’s major uses.
What Is Grafana?
Grafana converts monitoring data into understandable dashboards, graphs, tables, gauges, alerts, and other visualizations.
Grafana itself usually does not collect or store application metrics. It queries connected data sources and displays the returned metrics, logs, traces, or profiles.
Simple Example
Suppose a Linux server has high CPU utilization:
- Node Exporter exposes the server metrics.
- Prometheus collects and stores those metrics.
- Grafana queries Prometheus.
- A Grafana panel displays CPU utilization.
- An alert notifies the operations team when utilization exceeds a defined limit.
Why DevOps Engineers Use Grafana
DevOps and SRE teams use Grafana to:
- Monitor infrastructure and applications
- Visualize Kubernetes cluster health
- Create centralized operational dashboards
- Investigate performance problems
- Monitor AWS and Azure resources
- Configure alerts
- Compare current and historical performance
- Support incident troubleshooting
Grafana helps create a single monitoring view across several systems instead of checking each platform separately.
How Grafana Works
A standard monitoring workflow looks like this:
Application or Server
|
Exporter or Monitoring Agent
|
Prometheus, CloudWatch, Loki, or Database
|
Grafana Data Source
|
Queries
|
Dashboard Panels and Alerts
Main Components
Data source:
The system containing the data Grafana queries.
Query:
A request for specific data. Prometheus queries normally use PromQL.
Panel:
One visualization inside a dashboard.
Dashboard:
A collection of related panels.
Variable:
A reusable value such as server, cluster, namespace, environment, or AWS Region.
Alert rule:
A condition that Grafana evaluates and uses to trigger a notification.
Grafana vs. Prometheus
Grafana and Prometheus perform different jobs.
| Grafana | Prometheus |
|---|---|
| Visualizes operational data | Collects and stores metrics |
| Creates dashboards | Scrapes metric endpoints |
| Queries several data sources | Uses PromQL for metric queries |
| Provides visualization and alerting | Evaluates metric rules |
| Does not replace Prometheus | Does not provide Grafana-style dashboards |
Prometheus stores the metrics. Grafana queries Prometheus and presents those metrics through dashboards.
Important Grafana Features
1. Multiple Data Sources
Grafana can connect to metrics, log, tracing, cloud, and database systems. One dashboard can contain panels backed by different data sources.
2. Dashboards and Panels
A dashboard organizes related visualizations.
Common panels include:
- Time-series graph
- Stat
- Gauge
- Table
- Bar chart
- Heatmap
- Logs panel
Use each panel to answer a specific operational question.
Examples:
- Is CPU usage increasing?
- Which pod is restarting?
- Is application latency above the target?
- Which endpoint is returning errors?
- How much storage remains?
3. Dashboard Variables
Variables create reusable and interactive dashboards.
Instead of creating separate dashboards for development, testing, and production, create an $environment variable and switch environments from a drop-down menu.
Variables reduce dashboard duplication and maintenance.
Common variables include:
$cluster$namespace$pod$instance$application$region$environment
4. Alerting
Grafana Alerting watches metrics or logs for defined conditions.
An alert normally contains:
- Query
- Evaluation condition
- Evaluation frequency
- Contact point
- Notification policy
Example:
Alert when average CPU usage is greater than 80% for 10 minutes.
Notifications can then be routed to the configured contact point. Grafana provides a centralized interface for managing and responding to alerts from supported data sources.
5. Annotations
Annotations add event markers to graphs.
Examples:
- Application deployment
- Server restart
- Configuration change
- Production incident
Annotations help engineers determine whether a system change caused a performance issue.
6. Folders and Permissions
Folders organize dashboards by application, team, environment, or business unit.
Example:
Production
├── Kubernetes
├── Applications
├── Databases
└── AWS Infrastructure
Folder and dashboard permissions can control who can view or modify monitoring resources.
How to Create a Grafana Dashboard
Step 1: Add a Data Source
For Prometheus:
- Open Connections.
- Select Add new connection.
- Search for Prometheus.
- Enter the Prometheus server URL.
- Select Save & test.
Prometheus is supported directly as a Grafana data source.
Step 2: Create a Dashboard
- Open Dashboards.
- Select New dashboard.
- Select Add visualization.
- Choose the data source.
- Enter a query.
- Select the visualization type.
- Configure the title, unit, threshold, and legend.
- Save the dashboard.
Step 3: Use a PromQL Query
Example CPU query:
100 - (
avg by (instance) (
rate(node_cpu_seconds_total{mode="idle"}[5m])
) * 100
)
Example pod restart query:
increase(kube_pod_container_status_restarts_total[15m])
Do not memorize every query. Understand the metric, labels, time range, aggregation, and expected result.
Grafana with AWS CloudWatch
Grafana can use CloudWatch as a data source to visualize AWS metrics and CloudWatch Logs Insights results.
Common AWS dashboards include:
- EC2 CPU utilization
- EBS performance
- Lambda invocations and errors
- RDS connections and latency
- Application Load Balancer requests
- Auto Scaling activity
AWS also provides prebuilt dashboards for several services.
For production environments, grant Grafana only the IAM read permissions required to query CloudWatch.
Grafana on Kubernetes Using Helm
A common Kubernetes monitoring stack contains:
- Prometheus
- Alertmanager
- Grafana
- Node Exporter
- kube-state-metrics
The kube-prometheus-stack Helm chart installs these components and provisions curated Grafana dashboards.
Install the Stack
helm install monitoring \
oci://ghcr.io/prometheus-community/charts/kube-prometheus-stack \
--namespace monitoring \
--create-namespace
Check the resources:
kubectl get pods -n monitoring
kubectl get svc -n monitoring
Access Grafana Safely
For temporary local access:
kubectl port-forward \
-n monitoring \
svc/monitoring-grafana \
3000:80
Open:
http://localhost:3000
Port forwarding is an alternative to exposing Grafana through a public LoadBalancer.
Retrieve the Helm-Generated Password
For a release named monitoring:
kubectl get secret \
-n monitoring \
monitoring-grafana \
-o jsonpath="{.data.admin-password}" |
base64 --decode
echo
The username is normally:
admin
Do not assume prom-operator is the universal Grafana password. Helm deployments commonly generate administrator credentials in a Kubernetes Secret.
Dashboards as Code
Manually created dashboards are difficult to reproduce across environments.
Grafana provisioning lets teams define data sources and dashboards through configuration files that can be stored in Git. This supports version control, review, automation, rollback, and GitOps workflows.
A production workflow may look like this:
Dashboard JSON or configuration
|
Git repository
|
Pull request review
|
CI/CD or GitOps deployment
|
Grafana environment
Production Best Practices
- Use meaningful dashboard and panel names.
- Show service health before low-level details.
- Use variables instead of duplicating dashboards.
- Apply folders and least-privilege permissions.
- Enable HTTPS for browser access.
- Store credentials in Secrets Manager, Kubernetes Secrets, or another secret-management system.
- Avoid publicly exposing Grafana without authentication.
- Provision important dashboards through Git.
- Configure alerts for actionable conditions.
- Test alert delivery before relying on it.
- Keep dashboard queries efficient.
- Back up dashboards and configuration.
HTTPS protects login credentials and dashboard data transmitted between users and Grafana.
Common Grafana Problems
Dashboard Shows “No Data”
Check:
- Is the data source reachable?
- Is the correct URL configured?
- Does Save & test succeed?
- Does the query return data in the source system?
- Is the dashboard time range correct?
- Are the metric name and labels correct?
- Are variables returning values?
Grafana Cannot Connect to Prometheus
Inside Docker or Kubernetes, localhost usually refers to the Grafana container or pod—not the Prometheus service.
Use the Prometheus service DNS name, such as:
http://prometheus-server:9090
The exact service name depends on the deployment.
Dashboard Is Empty After Import
Check:
- Required data source
- Data-source UID
- Metric names
- Dashboard variables
- Exporter status
- Prometheus targets
- Dashboard compatibility
Kubernetes Dashboard Is Missing Metrics
Check:
kubectl get pods -n monitoring
kubectl get servicemonitor -A
kubectl get prometheusrule -A
Also verify that Prometheus targets are healthy and the required exporters are running.
Grafana Interview Questions and Answers
1. What is Grafana?
Grafana is an open-source visualization and observability platform used to query data sources and build dashboards and alerts.
2. Does Grafana store metrics?
Grafana normally queries metrics from systems such as Prometheus or CloudWatch. It is primarily the visualization and analysis layer.
3. What is a Grafana data source?
A data source is an external system that Grafana queries, such as Prometheus, CloudWatch, PostgreSQL, Elasticsearch, or Loki.
4. What is the difference between a panel and a dashboard?
A panel is one visualization. A dashboard is a collection of panels.
5. Why are dashboard variables important?
Variables make dashboards reusable across servers, applications, namespaces, clusters, Regions, and environments.
6. How does Grafana work with Prometheus?
Grafana connects to Prometheus as a data source, sends PromQL queries, receives metric results, and displays them in panels.
7. How do you access Grafana inside Kubernetes?
Common methods include local port forwarding or an appropriately secured external service. A public LoadBalancer is not mandatory.
8. How does Grafana alerting work?
Grafana evaluates queries against defined conditions and routes triggered alerts through configured notification policies and contact points.
9. How can dashboards be managed as code?
Dashboards and data sources can be provisioned from version-controlled files and deployed through CI/CD or GitOps.
10. What would you check when a panel shows no data?
I would verify data-source connectivity, query output, labels, variables, time range, permissions, exporter status, and Prometheus targets.
Final Interview Answer to Memorize
Grafana is an open-source visualization and observability platform. In our monitoring environment, Prometheus collected and stored infrastructure and Kubernetes metrics, while Grafana queried Prometheus using PromQL and displayed the results through dashboards. We created reusable dashboards with variables, configured alerts for CPU, memory, pod restarts, and application failures, and deployed the monitoring stack in Kubernetes using Helm. We also managed access securely and stored important dashboards in version control.
Conclusion
Grafana’s main purpose is to convert operational data into understandable dashboards and actionable alerts.
For DevOps interviews and real projects, focus on:
- Data sources
- Dashboards and panels
- Prometheus integration
- Variables
- Alerting
- Kubernetes and Helm
- Security
- Troubleshooting
- Dashboards as code