Grafana Loki stateful vs stateless components

Can someone give me list of Loki components that MUST be deployed in StatefulSet (stateful) and which can be deployed in Deployment (stateless)?

I see that in the documentation the only thing they mention explicitly about stateless component is for Distributor and Query frontend, how about the rest?

There are 8 components and there is no explicit information which component must be deployed in stateful vs stateless mode:

  • ingester ??
  • distributor → stateless
  • query-frontend → stateless
  • query-scheduler ??
  • querier ??
  • index-gateway ??
  • ruler ??
  • compactor ??

Also, if it stateful component, does it need to be mounted at the same path volume? Or, I can mount it separately? For example, Ingester (I guess it must be stateful, because it manages WAL), only mount to /ingester-data and Ruler should not have access to /ingester-data because it has it own WAL directory.

PS: this post is unanswered Loki querier, StatefulSet vs Deployment so I post the similar question here so others can explicitly know how to properly deploy Loki in Microservices mode.

I believe the only two components that need persistent volumes are ingester and compactor. If you are running simple scalable mode in version 2.8.2 then it would be the writer and backend components.

My next question, what is writer and backend components here? I don’t have any idea what is it, because in the documentation it just mention 8 components that I put above.

I am aware that using Helm chart, there are 3 components: read, write and backend, but what is it?

There are three modes of deployment for Loki, monolithic, simple scalable, or micro services. If you deploy in micro services mode you don’t need to worry about what backend is because each component is deployed individually. But if you are using simple scalable mode, then you are deploying three targets (read, write, backend), each target containing two or more individual components (essentially a way to reduce deployment complexity for smaller clusters).

after more read, I found that there is 4 stateful and 4 stateless Loki components

  • ingester → stateful
  • distributor → stateless
  • query-frontend → stateless
  • query-scheduler → stateless
  • querier → stateless
  • index-gateway → stateful
  • ruler → stateful
  • compactor → stateful

I had a similar question here regarding what backend is. Thanks to your post I was inspired to do a bit of a code-dive and found this:

So at the moment backend is an alias for {QueryScheduler, Ruler, Compactor, IndexGateway}. Read and write have their own sets of services.