MongoDB Cluster using Kubernetes

Please clarify
If I have MongoDB, and I would like to containerize it using docker and using Kubenetes wants to run it as say 3 replicas. I have given a volume for data outside the container.
Will now, all the 3 replicas (of MongoDB) point to the same volume and hence operate on the same data?
Who maintains the consistency in this case. Is it Kubernetes (or) MongoDB?


Hi, @sriramwaits

You just need to determine the number of replicas & the volume in the configuration file and Kubernetes will handle It for you.

Thank you.
So all the instances of MongoDB containers (say I have given replicas as 3), will write to the same volume & Kubernetes will maintain the consistency between the READS and WRITES?


Hello, @sriramwaits
I think you should prefer stateful set application type.
You can visit statefulset kubernetes for more details.