2

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...

  • What user were you running as when doing the install? – Rick James Nov 01 '21 at 15:49
  • I used my default non-root user on the local system. Just tried doing it with root, but there I cannot access the minikube cluster, nor start a new one, because docker doesn't allow being run with root privileges. – Relative_Programming Nov 02 '21 at 17:05
  • Correction: Got it to run with root priviledges, but the same problem with mkdir still persists. – Relative_Programming Nov 02 '21 at 18:29
  • 1
    Check permissions on the directory and its parent directory. It may have been previously created by your non-root installation. Use `chown` and/or `chmod` to fix. – Rick James Nov 02 '21 at 18:55

1 Answers1

1

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