How to ensure Grafana dashboards persist across upgrades
Description
Custom Grafana dashboards created via the UI will not persist across upgrades because they are not backed by a PV (Physical Volume). If you want dashboards to persist across upgrades you can do this using configMaps.
Solution
We recommend that you instead add custom dashboards via configmaps in the kubeaddons namespace that are automatically imported to Grafana using the label grafana_dashboard: "1"
that must be applied to the cm. These configmaps (and thus dashboards) will survive upgrades and continue to be imported into Grafana.
Example dashboard config:
apiVersion: v1 kind: ConfigMap metadata: name: sample-grafana-dashboard namespace: kubeaddons labels: grafana_dashboard: "1" data: k8s-dashboard.json: |- [...]
Reference URL:
https://github.com/helm/charts/tree/master/stable/grafana#sidecar-for-dashboards