I am trying to setup MySQL HA Database with Microk8s Kubernetes.
The goal is to have MySQL running on all 3 nodes with 1 floating IP in between them, and that if any of the nodes bursts up in flames database continues to function.
I have installed 3 nodes following , I grouped them together, and truly if I run microk8s kubectl get no I get
NAME STATUS ROLES AGE VERSION
node3 Ready <none> 4m28s v1.19.3-34+a56971609ff35a
node2 Ready <none> 25m v1.19.3-34+a56971609ff35a
node1 Ready <none> 37m v1.19.3-34+a56971609ff35aI enabled the dashboard and it works on all 3, on individual IPs.
Now I would like to install MySQL and have it use floating IP and for data to be kept on all 3.
My questions are:
- How to install MySQL on microk8s?
- How to have it Highly available for data to copy at all times.
- How to have floating IP?
Can anyone please point me to the correct tutorial or help me achieve this?
Thank you
1 Answer
For database operation in kubernetes you'll need a statefullset
example setup with mysql described by kubernetes project here :
there is also a cloud native graduated project which might be interesting :
having DBs in a kubernetes cluster (with HA etc) is pretty complicated and having your DB out of kubernetes might also be an idea :