Home > database >  MongoDB sharded cluster vs MongoDB on Kubernetes
MongoDB sharded cluster vs MongoDB on Kubernetes

Time:07-11

I'm deploying a simple Flask app using MongoDB in different VMs. For that I configured 2 config servers, 2 mongos instances and 2 shards with 2 replicas each (all of this in different VMs).

My question is simple, what is the difference between doing it this way (using 8 VMs without K8s) or doing it with a single VM and using Kubernetes to handle it all?

CodePudding user response:

The reason why you deploy multiple instances of each of these components is to increase your availability and tolerance to handle fault.

What you want to achieve is to spread those 8 servers across as many physical machines as you can. Ideally each of these components that you run multiples of (e.g. the config servers) should not run on the same physical machine.

If you run the 8 VMs on a single physical machine or deploying 8 Kubernetes pods on a k8s cluster of one physical machine, you are not gaining anything in terms of fault tolerance or increased availability of your cluster.

In that case you would only gain the benefits of using an elaborate orchestrator like kubernetes to manage your containers.

  • Related