MySQL - Galera OR Kubernetes Replication Controller?

3/10/2017

I have a web server structure with two MySQL servers balanced by Galera.

Now, I'm building the same structure, but with Kubernetes and pods ... I realized that if I make Replication Controller hover a POD from MySQL, I might not need the Galera Cluster ...

Is this reasoning correct?

Thanks in advance.

-- JuliSmz
cluster-computing
docker
kubernetes
mysql

2 Answers

3/12/2017

Without the Galera cluster I think it would be hard to have more than one MySQL running at the same time, for High Availability.

That said. A Stateful Set with just one replica, with a Persistent Volume for storage, would be fine if you can live through the downtime between the pod dies and is restarted (using the same files).

If you really need the cluster to be online even if one of the pods/nodes dies you would need something like Galdera cluster, or standard mysqls running multi-master/active-active (ie being able to handle writes at any server, at any time).

I would investigate if something like Cassandra would work, it has a much better fit inside Kubernetes. Or I would run MySQL outside of the Kubernetes cluster.

-- Andreas Wederbrand
Source: StackOverflow

3/11/2017

Replication Controllers are replaced with Deployments. Deployments are usually used for stateless containers. For a database container, (statefulcontainer) you need to use statefulsets with persistent volumes.

If you are using galera for high availablity only and you dont mind a minute or so service downtime on node failure event, then you dont need to use galera on multi node kubernetes deployment.

If you are using it for distributing the load and/or you cant tolerate any downtime, you still need galera.

There are a couple of galera yaml files for kubernetes.

-- Farhad Farahi
Source: StackOverflow