Overview
Grafana provides unified visualization for metrics (Prometheus), logs (Loki), and traces (Tempo). It’s deployed as part of the kube-prometheus-stack and includes pre-configured data sources and dashboards.Configuration
Nixidy Module (nixidy/env/local/kube-prometheus-stack.nix)
Access
- URL: http://localhost:30300
- Username:
admin - Password:
admin - Port: 30300 (NodePort)
Data Sources
Grafana is pre-configured with three observability backends:Prometheus (Default)
- URL:
http://kube-prometheus-stack-prometheus.observability:9090 - Type: Metrics
- Default: Yes
Loki
- URL:
http://loki.observability:3100 - Type: Logs
- Access: Proxy mode
Tempo
- URL:
http://tempo.observability:3200 - Type: Traces
- Access: Proxy mode
Correlation Features
Grafana enables correlation between telemetry types:Traces → Logs
Traces → Metrics
Service Map
Loki Search from Traces
Dashboards
Built-in Dashboards
The kube-prometheus-stack includes dashboards for:- Kubernetes cluster: Node, pod, namespace metrics
- Kubernetes resources: CPU, memory, network, disk
- Prometheus: Query performance, scrape health
- Alertmanager: Alert status and history
- Node Exporter: Host-level system metrics
- Workloads: Deployment, StatefulSet, DaemonSet metrics
- Persistent Volumes: Storage usage
Custom Dashboards
Custom dashboards are defined using Grafonnet (Jsonnet library) indashboards/src/:
sample-app.jsonnet- Application-specific metricsk8s-cluster.jsonnet- Cluster overview
Dashboard Auto-Loading
Grafana automatically loads dashboards from ConfigMaps in theobservability namespace with appropriate labels.
Visualization Types
Time Series
Metrics over time (Prometheus queries):Logs Panel
Log streaming from Loki:Trace View
Distributed trace visualization from Tempo (Jaeger-style UI).Service Graph
Service dependency map derived from trace spans.Deployment
Grafana runs as a Deployment in theobservability namespace:
- Replicas: 1
- Namespace:
observability - Service: NodePort on 30300
- Storage: ConfigMap-based dashboards
Observability Workflows
Debugging Slow Requests
- View service metrics in Prometheus dashboard
- Identify slow endpoint from trace service map
- Open trace in Tempo to see span timing
- Click span → View logs in Loki for errors
Investigating Errors
- Query Loki for error logs
- Extract trace ID from log entry
- Open trace in Tempo
- Correlate with metrics spike in Prometheus
Capacity Planning
- Use Kubernetes dashboards for resource usage
- Identify bottlenecks (CPU, memory, network)
- Correlate with application metrics
- Plan scaling based on trends
Integration
Prometheus
Default data source for all metrics dashboards.Loki
Log aggregation with label-based filtering:Tempo
Trace backend with exemplar support (links from metrics to traces).ConfigMaps
Dashboards are stored as ConfigMaps inmanifests/kube-prometheus-stack/ConfigMap-*-dashboard.yaml.
Alerting
Grafana can send alerts based on queries, but in this stack, alerting is primarily handled by Prometheus Alertmanager.Related Components
- Prometheus - Metrics data source
- Loki - Logs data source
- Tempo - Traces data source