Automatically scale replicas in mongodb operator

Hello,

Is it possible to automatically scale number or replicas based on the CPU load of the replica pods for Percona kubernetes mongodb operator ? I like to automate the cluster, if there is a sudden load that the cluster cannot handle, to scale it automatically - add more replicas. Then, when the load decreases to remove those added replicas. Can this be solved somehow ?

If you carefully think it through, then you might notice, that it does not make sense. So if you scale up from lets say 3 → 6 this might be possible but how long does it take to copy/replicate the disk. How do you want to downscale ? Remember you not only need to reduce the # of replicas you also need to release the PV/PVC.
I think it’s more economical if you play with request/limit cpu of the replicas.

1 Like

@jamoser Thank you for your reply, I may think for increasing requests/limits, but also this will not be easy to make it automatic, since I have provisioned pool of nodes. To increase the requests, I need to provision new nodes with more cpu and move those pods to the new nodes.

1 Like

Well if you have node affinity it’s super easy to do that. You configure your cr.yaml and apply it and you can watch how the replicaset “moves” to the new node pool. Without “service” disruption !

1 Like

Thank you for the idea, I will use this :slight_smile:

1 Like