colinmollenhour / mariadb-galera-swarm

MariaDb Galera Cluster container based on official mariadb image which can auto-bootstrap and recover cluster state.
https://hub.docker.com/r/colinmollenhour/mariadb-galera-swarm
Apache License 2.0
217 stars 102 forks source link

Add Kubernetes (k8s) example #58

Closed dadittoz closed 5 years ago

dadittoz commented 5 years ago

Hello,

I've recently was able to run your image on Kubernetes. I thought it might be useful for someone, so I've decided to make a pull request.

colinmollenhour commented 5 years ago

I was really excited about your k8s example as I've been wanting to try it with k8s but haven't learned enough about it yet. Not sure why you closed it, but are you going to submit another one?

dadittoz commented 5 years ago

Sorry, I've just found out it doesn't work good enough unfortunately. Every socat attempt hangs for a few minutes if whole cluster IPs were already changed. It's actually impossible to boot a cluster on a total cluster outage. Or at least in a reasonable timeframe. I am not sure if it is possible to add timeout to socat. Or if it's even a good idea. I am currently looking into https://github.com/ausov/k8s-mariadb-cluster approach with peer-finder. It might be easier just to get cluster IPs at boot, rather than to attempt to reconnect to old addresses. Too bad his image doesn't support xtrabackup-v2 wsrep_sst_method. But it might be easier just to patch his image. In this example I've also used Deployment instead of StatefulSet. I guess k8s saves container IPs for StatefulSets and it might be easier to deal with full cluster restart. But anyhow, full cluster outage is not recoverable in my example, so I decided to pull it off.

colinmollenhour commented 5 years ago

Thanks for the info either way. Cheers!