In this tutorial, we are going to set up a MongoDB ReplicaSet in a K8s cluster using a kustomize. We will be writing some init scripts to be run at the first MongoDB start and we will be able to scale up and down replica set count with simple kubectl command.
According to MongoDB Docs: A replica set in MongoDB is a group of mongod processes that maintain the same data set. Replica sets provide redundancy and high availability, and are the basis for all production deployments.
https://www.spectrocloud.com/blog/kustomize-your-way-to-mongodb-replicaset/
Note: Since Each mongoDB server have a lock file inside the mongo dir. If we share the dir the new nodes wont be able to start