You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MariaDB 10.4 with automatic cluster generation under kubernetes / swarm using named volumes for data persistence. This has robust bootstrap logic based on MariaDB / Galera documentation for automated cluster create / join operations.
4
+
MariaDB 12.x with automatic cluster generation under kubernetes / swarm using named volumes for data persistence. This has robust bootstrap logic based on MariaDB / Galera documentation for automated cluster create / join operations. Requires an etcd instance for sharing instance-health data across the cluster.
5
5
6
6
### Usage - kubernetes
7
7
8
-
Define the following dependencies before launching the cluster: passwords for root and SST, network load balancer, and a dedicated etcd key-value store. Here's how:
8
+
Define the following dependencies before launching the cluster: password for root, network load balancer, and a dedicated etcd key-value store. Here's how:
9
9
10
10
Create a random root password:
11
11
```
@@ -25,7 +25,7 @@ EOT
25
25
sekret enc /dev/shm/new.yaml >secrets/$SECRET
26
26
rm /dev/shm/new.yaml
27
27
```
28
-
You can use a tool like [sops](https://github.com/mozilla/sops) or [sekret](https://github.com/nownabe/sekret) to generate the secrets file. Do the same for an sst-auth-password.
28
+
You can use a tool like [sops](https://github.com/mozilla/sops) or [sekret](https://github.com/nownabe/sekret) to generate the secrets file.
29
29
30
30
Set any local my.cnf values in files under a volume mount for
31
31
/etc/mysql/my.cnf.d (mapped as $ADMIN_PATH/mariadb/etc/). Use
@@ -90,9 +90,19 @@ cd docker-tools/k8s
90
90
make db00
91
91
~~~
92
92
93
+
### Restarting
94
+
95
+
When taking the database down, wait for all pods to stop, and then clear etcd entries for the cluster:
96
+
```
97
+
CLUSTER=db00
98
+
ETCD_HOST=10.101.1.19
99
+
etcdctl --endpoints=$ETCD_HOST:2379 del --prefix /galera/$CLUSTER
100
+
```
101
+
Then launch with the helm chart or docker-compose.
102
+
93
103
### Usage - swarm
94
104
95
-
This was originally developed under docker Swarm. A [docker-compose](https://github.com/instantlinux/docker-tools/blob/main/images/mariadb-galera/docker.compose) file is a legacy of that original work. Before stack-deploying it, invoke _docker secret create_ to generate the two secrets _mysql-root-password_ and _sst-auth-password-, and define an ADMIN_PATH environment variable pointing to your my.cnf (it has to be in the same location on each docker node).
105
+
This was originally developed under docker Swarm. A [docker-compose](https://github.com/instantlinux/docker-tools/blob/main/images/mariadb-galera/docker.compose) file is a legacy of that original work. Before stack-deploying it, invoke _docker secret create_ to generate the secret _mysql-root-password_, and define an ADMIN_PATH environment variable pointing to your my.cnf (it has to be in the same location on each docker node).
96
106
97
107
### Variables
98
108
@@ -102,11 +112,11 @@ This was originally developed under docker Swarm. A [docker-compose](https://git
| LOG_LEVEL | info | set to debug for additional logging |
105
116
| REINSTALL_OK || set to any value to enable reinstall over old volume |
106
-
|ROOT_PASSWORD_SECRET| mysql-root-password | name of secret for password |
117
+
|ROOT_SECNAME| mysql-root-password | name of secret for password |
107
118
| TTL | 10 | longevity (in seconds) of keys posted to etcd |
108
119
| TZ | UTC | timezone |
109
-
| SST_AUTH_SECRET | sst-auth-password | name of secret for password |
110
120
111
121
### Notes
112
122
@@ -129,6 +139,8 @@ configuration. It requires a stable etcd configuration for node
129
139
discovery and master election at restart. A single instance can
130
140
be invoked without HA resources using kubernetes-single.yaml.
131
141
142
+
There is no supported etcd3 library for python3 (as of Oct 2025). For now, this is using python-etcd3 0.12.0, last updated in 2020, with PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION set for compatibility.
143
+
132
144
### Credits
133
145
134
146
Thanks to ashraf-s9s of severalnines for the healthcheck script.
0 commit comments