I’m looking into deploying grafana on an on-prem k8s cluster using the grafana helm chart.
I’d like to have it run in a HA configuration with several grafana pods replicas and I read that using a database is a must in such a case (Set up Grafana for high availability | Grafana documentation).
However, since the plan is to install grafana on k8s, is it possible to use a pvc instead of a database? If all the grafana pods will share the same pvc, wouldn’t that replace the need for a database? The storage class the pvc will use can handle multiple process access to files (sort of like an NFS).
Has anyone successfully deployed grafana in a HA setup on k8s with only a pvc?
we don’t want to conflate storage with application backend unless the application uses files in volumes to function (though sqlite is a file but you know what I mean)
We are excited that you joined our OSS community. Please read about some of the FAQs in the community
I talked to the Engineering folks and the short answer is that Grafana does need a Database.
Long answer:
Grafana needs a database. SQLite stores its DB on disk and thus can be stored in a PVC.
However, PVCs are per pod, so you can’t (generally) mount a PVC onto two instances. Then, there’s the fact that an SQLite database isn’t designed for concurrent writes, so even if you did, you’d get yourself into trouble.
I’ll look into what DB to use.
If I point Grafana to use for example a postgres StatefulSet cluster as its DB (which will have its own pvc for saving DB data over pod restarts), does this mean I can disable persistence in Grafana’s values.yaml?
Or is persistence still required if I want to save dashboards and alerts across Grafana pod restarts for a HA setup, assuming I enable persistence with pvc instead of using the sidecar+configMaps option?