Running Highly available Database on kubernetes pods (with automatic configuration)
I want to run a highly available database on kubernetes pods. I am able to run mongodb but after the deployment is finished, we need to run some manual steps to scale out mongodb and I am not able to find any way to automate that. Is there a way to automate the process, where 3 replicas on kubernetes are run as a single HA database? Open to change in choice of DB also.
You might consider using a serverless database like Zetabase (https://zetabase.io) or even one of the Redis Cloud products? I find with k8s this allows you to stick much closer to the core k8s paradigms with no need to bend the rules to allow for managing persistence mechanisms.
If not, I'd recommend finding some other way to avoid managing the HA database yourself -- this necessarily entails a lot of complexity and it's easier to lay that off onto someone else IMO.
You may want to check Crunchy PostgreSQL Operator
Its job is to simplify deploying and managing postgres clusters on Kubernetes. You can easily create, scale clusters and among any other features you have high-availability possible.
Safe, automated failover backed by a distributed consensus based high-availability solution. Uses Pod Anti-Affinity to help resiliency; you can configure how aggressive this can be! Failed primaries automatically heal, allowing for faster recovery time.