Dashboards¶
Grafana in this chart auto-loads dashboards from any ConfigMap labelled with
grafana_dashboard: "1". You add dashboards by creating ConfigMaps; you do
not need to log in and import them by hand.
How discovery works¶
The Grafana subchart runs a sidecar container alongside Grafana. The sidecar watches Kubernetes for ConfigMaps with a specific label and copies their JSON content into the Grafana provisioning folder. Grafana picks the new dashboard up within a few seconds. No restart required.
Default sidecar settings (set by the Grafana subchart):
grafana:
sidecar:
dashboards:
enabled: true
label: grafana_dashboard
labelValue: "1"
folder: /tmp/dashboards
searchNamespace: ALL # watch every namespace
provider:
foldersFromFilesStructure: true
Adding a dashboard via ConfigMap¶
- Get a dashboard JSON file (export from Grafana, or download from grafana.com/dashboards).
- Wrap it in a ConfigMap:
apiVersion: v1
kind: ConfigMap
metadata:
name: my-app-overview-dashboard
namespace: my-app
labels:
grafana_dashboard: "1"
annotations:
# Optional: put it into a specific Grafana folder
grafana_folder: "My App"
data:
my-app-overview.json: |-
{
"title": "My App Overview",
"panels": [ ... ],
"schemaVersion": 39,
"version": 1
}
kubectl apply -fand reload Grafana — the dashboard appears under theMy Appfolder.
Keep dashboard JSON in your repo
Treat the dashboard JSON as code. Either:
- Store the raw JSON next to the ConfigMap manifest, then commit both, or
- Templated approach: use a Helm chart of your own that ships a
ConfigMapper dashboard.
Disabling default dashboards¶
The chart ships dashboards for kubelet, node, API server, etcd, Pods, namespaces, persistent volumes, and more. Toggle them with:
grafana:
defaultDashboardsEnabled: false
You can also turn off individual dashboards by editing
grafana.dashboards.* (see the upstream chart values.yaml for the full
list).
Adding extra datasources¶
grafana:
additionalDataSources:
- name: Loki
type: loki
url: http://loki-gateway.logging.svc:3100
access: proxy
isDefault: false
- name: Tempo
type: tempo
url: http://tempo-query-frontend.tracing.svc:3100
access: proxy
The default Prometheus datasource is created automatically by the chart and points at the in-cluster Prometheus Service.
Plugins¶
grafana:
plugins:
- grafana-piechart-panel
- grafana-clock-panel
- vonage-status-panel
The Grafana pod restarts to install plugins on first start.
SMTP and notifications inside Grafana¶
The chart's Alertmanager handles Prometheus alerts. If you want Grafana itself to send dashboard-based alerts (Grafana Unified Alerting), configure SMTP through the Grafana subchart values:
grafana:
grafana.ini:
smtp:
enabled: true
host: smtp.example.com:587
user: alerts@example.com
password: "<from-secret>"
from_address: alerts@example.com
from_name: Grafana
server:
root_url: https://grafana.example.com
Prefer Alertmanager for production alerts; use Grafana Alerting for dashboard-driven, exploratory alerting.
Where the dashboards live in the chart¶
Inside prometheus-stack/templates/grafana/dashboards-1.14/ you'll find one
ConfigMap template per default dashboard. They are gated by
grafana.defaultDashboardsEnabled and individual grafana.dashboards.*
toggles.
If you need to override a built-in dashboard, the simplest approach is:
grafana.defaultDashboardsEnabled: falsefor the dashboard in question (or globally).- Ship your own ConfigMap with the same
uidso existing links keep working.