0

I need to deploy Grafana in a Kubernetes cluster in a way so that I can have multiple persistent volumes stay in sync - similar to what they did here.

Does anybody know how I can use the master/slave architecture so that only 1 pod writes while the others read? How would I keep them in sync? Do I need additional scripts to do that? Can I use Grafana's built-in sqlite3 database or do I have to set up a different one (Mysql, Postgres)?

There's really not a ton of documentation out there about how to deploy statefulset applications other than Mysql or MongoDB.

Any guidance, experience, or even so much as a simple suggestion would be a huge help. Thanks!

FestiveHydra235
  • 473
  • 1
  • 7
  • 23

1 Answers1

2
  1. StatefulSets are not what you think and have nothing to do with replication. They just handle the very basics of provisioning storage for each replica.
  2. The way you do this is as you said by pointing Grafana at a "real" database rather than local Sqlite.
  3. Once you do that, you use a Deployment because Grafana itself is then stateless like any other webapp.
coderanger
  • 52,400
  • 4
  • 52
  • 75
  • Thanks for the reply. But how would I then make sure each of my persistent volumes stays in sync (master/slave?). Do you know of any scripts or examples you could point me to? I do have a requirement for a persistent volume to be provisioned for each replica. I can't have a single persistent volume that they all point to as that's a risk for single point of failure. So that's why I thought stateful sets made the most the most sense. But I'm not sure how to keep each one in sync with another - even if I did use deployment. – FestiveHydra235 Aug 10 '21 at 03:16
  • As I said, none of that is handled by Kubernetes. Postgres and MySQL have their own replication systems. All Kubernetes is doing is setting up the storage for it. You are way way over-imagining how this all works :) And as to Grafana, once you point it at a real DB server, it doesn't need any local storage, persistent or otherwise. – coderanger Aug 10 '21 at 05:33