I am working on a scenario where the db cluster needs to stop and start up as required…
I know there is always kubectl delete cr.yaml command, which would obviously destroy all the pods. But then to start them up again, I would have to use kubectl apply command again right? Is there a functionality by which the cluster can be stopped (in place of getting completely destroyed) and then started up again?
Hi, there is!
You can put the cluster on pause, by changing the value of the spec.pause key to “true” as explained here: https://www.percona.com/doc/kubernetes-operator-for-pxc/pause.html
after changing it, apply the new spec: kubectl apply -f deploy/cr.yaml
Sorry if I’m wrong, but isn’t that for the xtraDB cluster? Can that value be used for mongoDB as well? As far as I know, there is no value like spec.pause…
I will try it out regardless. Thank you!
Just a note that I did try this, but I guess it is a spec for xtraDB, not MongoDB operator for k8s. Would be really great if a similar feature is provided for on demand shutdown of mongoDB clusters.