How do you manage Grafana dashboards as code?
IntermediateScenarioGrafana, Dashboards and Kubernetes Monitoring
Answer
Situation read → Manual UI edits get lost and cannot be reviewed.
What I'd do →
- Store dashboard JSON in Git; generate it with Grafonnet (Jsonnet) or the Grafana Foundation SDK for reuse.
- Deploy via file provisioning (
/etc/grafana/provisioning/dashboards), the Grafana Terraform provider (grafana_dashboard), or the Grafana OperatorGrafanaDashboardCRD. - In Kubernetes with kube-prometheus-stack, ship dashboards as ConfigMaps labelled
grafana_dashboard: "1"picked up by the sidecar. - Lock provisioned dashboards (
allowUiUpdates: false) to force changes through PRs.
Why → Reviewable, reproducible and restorable dashboards.
Interview tip → Mention that you test dashboards in a staging Grafana before merging.
More on Grafana, Dashboards and Kubernetes Monitoring
Grafana has 900 dashboards and nobody can find anything. How do you clean it up?IntermediateDesign a service overview dashboard that an on-call engineer can read in 10 seconds.BeginnerYou need to show deploy events on every Grafana graph. How?BeginnerPods are being OOMKilled but the memory graph never reaches the limit. Why?IntermediateHow do you detect CPU throttling hurting latency in Kubernetes?IntermediateYou inherit a cluster with no monitoring. What do you install first?Beginner