I want to deploy a MariaDB Galera instance onto a local Minikube cluster with 3 nodes via Helm. I used the following command for that:
helm install my-release bitnami/mariadb-galera --set rootUser.password=test --set db.name=test
The problem is, if I do that I get the following error in the log:
mariadb 10:27:41.60
mariadb 10:27:41.60 Welcome to the Bitnami mariadb-galera container
mariadb 10:27:41.60 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-mariadb-galera
mariadb 10:27:41.60 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-mariadb-galera/issues
mariadb 10:27:41.61
mariadb 10:27:41.61 INFO ==> ** Starting MariaDB setup **
mariadb 10:27:41.64 INFO ==> Validating settings in MYSQL_*/MARIADB_* env vars
mariadb 10:27:41.67 INFO ==> Initializing mariadb database
mkdir: cannot create directory '/bitnami/mariadb/data': Permission denied
The site of the image lists the possibility to use an extra init container to fix that (Link).
So I came up with the following configuration:
mariadb-galera-init-config.yaml
extraInitContainers:
- name: initcontainer
image: bitnami/minideb
command: ["chown -R 1001:1001 /bitnami/mariadb/"]
The problem is that when I run the command with this configuration:
helm install my-release bitnami/mariadb-galera --set rootUser.password=test --set db.name=test -f mariadb-galera-init-config.yaml
I get the following error on the Minikube dashboard:
Error: failed to start container "initcontainer": Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "chown -R 1001:1001 /bitnami/mariadb/": stat chown -R 1001:1001 /bitnami/mariadb/: no such file or directory: unknown
I don't know how to fix this configuration file, or if there is some other better way to get this working...
In any case someone has issues with this, may I suggest running a initContainer before.
initContainers:
- name: mariadb-create-directory-structure
image: busybox
command:
[
"sh",
"-c",
"mkdir -p /bitnami/mariadb/data && chown -R 1001:1001 /bitnami",
]
volumeMounts:
- name: data
mountPath: /bitnami