0

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 https://microk8s.io/high-availability , 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+a56971609ff35a

I 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:

  1. How to install MySQL on microk8s?
  2. How to have it Highly available for data to copy at all times.
  3. How to have floating IP?

Can anyone please point me to the correct tutorial or help me achieve this?

Thank you

Perovic
  • 21
  • 1
  • 7

1 Answers1

0

For database operation in kubernetes you'll need a statefullset

example setup with mysql described by kubernetes project here : https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/

there is also a cloud native graduated project which might be interesting : https://vitess.io/

having DBs in a kubernetes cluster (with HA etc) is pretty complicated and having your DB out of kubernetes might also be an idea : https://cloud.google.com/blog/products/databases/to-run-or-not-to-run-a-database-on-kubernetes-what-to-consider

Koen
  • 1,107
  • 6
  • 15