π Why Visualization Matters
Telemetry data β logs, metrics, and traces β gives you deep insights into your systemβs behavior. But letβs be honest: staring at JSON traces or YAML logs isnβt exactly thrilling.
Thatβs where visualization comes in.
A good dashboard:
- Gives instant visibility into system health
- Helps correlate metrics, logs, and traces
- Makes debugging, alerting, and capacity planning effortless
π§ Meet Grafana: The Observatory for Observability
Grafana is an open-source analytics and visualization platform designed to work with various telemetry backends β including:
- Prometheus (for metrics)
- Loki (for logs)
- Jaeger (for traces)
Grafana is:
- Pluggable
- Real-time
- Customizable
It turns raw observability data into actionable dashboards.
π Deploying Grafana in Kubernetes
Weβll deploy Grafana with a basic Deployment and Service. You can customize it with a persistent volume or admin credentials if needed.
apiVersion: apps/v1
kind: Deployment
metadata:
name: grafana
labels:
app: grafana
spec:
replicas: 1
selector:
matchLabels:
app: grafana
template:
metadata:
labels:
app: grafana
spec:
containers:
- name: grafana
image: grafana/grafana:10.3.1
resources:
requests:
cpu: "10m"
memory: "56Mi"
limits:
cpu: "20m"
memory: "128Mi"
ports:
- containerPort: 3000
volumeMounts:
- name: grafana-storage
mountPath: /var/lib/grafana
env:
- name: GF_SECURITY_ADMIN_USER
value: "admin"
- name: GF_SECURITY_ADMIN_PASSWORD
value: "admin"
volumes:
- name: grafana-storage
emptyDir: {} # Replace with PersistentVolumeClaim for persistence
---
apiVersion: v1
kind: Service
metadata:
name: grafana
labels:
app: grafana
spec:
selector:
app: grafana
ports:
- protocol: TCP
port: 3000
targetPort: 3000
type: ClusterIP
π§Ύ Deploy Grafana
# Apply deployment and service files
kubectl -n observability apply -f grafana.yaml
# Check Grafana pod logs
kubectl logs -l app=grafana -n observability
# Port-forward Grafana service to access UI locally
kubectl -n observability port-forward svc/grafana 3000:3000
Now visit http://localhost:3000 in your browser.
Default credentials:
- Username:
admin
- Password:
admin
π Configure Datasources in Grafana
Once inside the Grafana UI, follow these steps to add your observability backends:
1οΈβ£ Add Prometheus as a Datasource:
- Go to Home β Connections β Data sources
- Click Add new data source
- Choose Prometheus
- Set URL to:
http://prometheus.observability.svc.cluster.local:9090
- Click Save & Test
2οΈβ£ Add Loki as a Datasource:
- Repeat above steps, choose Loki
- Set URL to:
http://loki.observability.svc.cluster.local:3100
- Save & Test
3οΈβ£ Add Jaeger as a Datasource:
- Choose Jaeger from the list
- Set URL to:
http://jaeger.observability.svc.cluster.local:16686
- Save & Test
π Explore Logs, Metrics, and Traces
Head over to the Explore tab in Grafana:
- Select Loki β Run a log query like
{exporter="OTLP"} |= `house-price-service`
- Select Jaeger β Search traces for your app, filtered by service name
- Select Prometheus β Query custom app metrics
π₯ This is your real-time debugging playground.
π§± Build a Unified Dashboard
Now letβs pull it all together.
π§ Steps to Create a Dashboard:
Go to the Dashboards section β Click New Dashboard
Add a Panel:
- For Metrics: Use Prometheus queries (e.g., request rate, latency)
- For Logs: Use Loki query (e.g., by app label)
- For Traces: Use Jaeger panel or link to trace visualizer
- Organize the panels side-by-side:
- App throughput (metric)
- App logs (filtered view)
- Recent traces
- Save the dashboard and give it a name like
House Price App Observability
π― Conclusion
You now have a complete, three-pillar observability stack running on Kubernetes:
- π Metrics via Prometheus
- πͺ΅ Logs via Loki
- π Traces via Jaeger
- π§ Visualized in Grafana
All powered by OpenTelemetry β the glue connecting them.
βοΈ Whatβs Next?
You now have full visibility into your application β but what about the Kubernetes cluster itself?
In the final part of the series, weβll expand our observability beyond the app and dive into cluster-level insights. This includes monitoring:
- Node and pod CPU/memory usage
- Kubernetes control plane metrics
- Scheduler performance, kubelet stats, and more
{
"author" : "Kartik Dudeja",
"email" : "[email protected]",
"linkedin" : "https://linkedin.com/in/kartik-dudeja",
"github" : "https://github.com/Kartikdudeja"
}
Top comments (0)