Kubernetes MongoDB autoscaling Kubernetes MongoDB autoscaling kubernetes kubernetes

Kubernetes MongoDB autoscaling


As @PjoterS suggest you can scale the mongoDB replicas or pods inside the kubernetes using HPA.

But with that you should have to also take care about the volume mounting with it.also data latency between replicas.

I would suggest better first check the native scaling cluster option provided by the mongo db it self and configure. You can use some operators for mongoDB like : https://docs.mongodb.com/kubernetes-operator/master/tutorial/install-k8s-operator/

Otherwise if you have current config is following native cluster and support scaling replica and data copy between replca's you can go for HPA.

you can also have a look at this : https://medium.com/faun/scaling-mongodb-on-kubernetes-32e446c16b82


As you are using Kubernetes, which is Container Orchestration platform, you can always scale your deployment/statefulset using $ kubectl scale deployment [deployment_name] --repplicas=Xor $ kubectl scale statefulset [statefulset-name] --replicas=Xwhere X means how many pods in total you want to have in deployment. It will create autoamatically pods based on your deployment settings.If you don't want to create it manually, you should read about Kubernetes autoscaling - HPA.

About exposing application outside Kubernetes you have to do it using Service. More information can be found here. I am not sure if NodePort is right in this scenario. You can check ServiceType description.

However I am not very familiar with MongoDB with Kubernetes, but maybe those tutorials help you.Scaling MongoDB on Kubernetes, Running MongoDB as a Microservice with Docker and Kubernetes, Running MongoDB on Kubernetes with StatefulSets.

Hope it will help.