0

So, a StatefulSet creates a new volume for each of its pod.

How does it maintain consistency of the written data. Because, each pod may serve a different client at a specific moment in time and will be writing different stuff to the volume. But, if this client tries to access the data later, it will have to connect to the same pod somehow to access its own data. Do these pods talk to each other to share data?

I may have asked a silly question

I think I know the answer, but I am confused. I won't tell the answer just to get an unbiased reply

Aniket
  • 153
  • 1
  • 2
  • 8
  • This question might be better suited for [DevOps](https://devops.stackexchange.com/) or [SF]. --- There are several approaches. If each pod writes to a separate storage (which is in most cases not what you want), we can use sticky sessions on the ingress. There is also the option to mount the same persistent volume in each pod, but I vaguely remember that only block storage is supported. Other storage might work, but may lead to undefined behaviour. – Turing85 May 15 '21 at 20:03
  • @Turing85 why was this closed? This is about how to run its own application or how to program the API, see e.g. https://meta.stackoverflow.com/a/386638/213269 for what is on-topic. – Jonas May 15 '21 at 20:26
  • @Jonas You do not need to comment on each question. In my opinion, the question has nothing to do with programming or programming-related tools, therefore it is off-topic. – Turing85 May 15 '21 at 20:41
  • @Jonas It appears to be asking how kubernetes functions on a system level, rather than asking "a practical, answerable problem that is unique to software development". – Makyen May 15 '21 at 20:44

1 Answers1

1

How does it maintain consistency of the written data. Because, each pod may serve a different client at a specific moment in time and will be writing different stuff to the volume. But, if this client tries to access the data later, it will have to connect to the same pod somehow to access its own data. Do these pods talk to each other to share data?

Kubernetes does nothing about this. But you are right, these things are needed. The application is responsible for this. There are many ways to do this, e.g. using Raft Consensus Algorithm

Jonas
  • 121,568
  • 97
  • 310
  • 388