<p>I am trying to initialize a fresh instance of MariaDB (putting my .sql file inside /docker-entrypoint-initdb.d) using the official helm chart at <a href="https://github.com/helm/charts/tree/master/stable/mariadb#initialize-a-fresh-instance" rel="nofollow noreferrer">https://github.com/helm/charts/tree/master/stable/mariadb#initialize-a-fresh-instance</a>.</p>
<p>But I find the instructions quite unclear:</p>
<blockquote>
<p>In order to execute the scripts, they must be located inside the chart folder <code>files/docker-entrypoint-initdb.d</code> so they can be consumed as a ConfigMap.</p>
</blockquote>
<p>Since the only thing I do to set up the Mariadb cluster is using their <code>helm install --name my-release stable/mariadb -f values-production.yaml</code> I am quite confuse.</p>
<p>Where is this folder ?</p>
<hr />
<h3>Edit</h3>
<p>I downloaded <a href="https://github.com/helm/charts/tree/master/stable/mariadb" rel="nofollow noreferrer">https://github.com/helm/charts/tree/master/stable/mariadb</a> and placing (the whole folder) and placed my SQL file inside <code>files/docker-entrypoint-initdb.d</code>.</p>
<p>I then used <code>helm package ./mariadb</code> followed by <code>helm install ./mariadb -f ./mariadb/values-production.yaml</code>. But the master pod has &quot;CrashLoopBackOff&quot; as status.</p>
<p>Here are the master logs</p>
<pre><code>==&gt; ** Starting MariaDB setup **
==&gt; Validating settings in MYSQL_*/MARIADB_* env vars..
==&gt; Initializing mariadb database...
==&gt; Persisted data detected. Restoring...
==&gt; Loading user's custom files from /docker-entrypoint-initdb.d ...
==&gt; Stopping mariadb...
</code></pre>
<p>I also tried this way, but the db keep crashing</p>
<pre><code>kubectl create configmap db-scheme --from-file=db.sql
helm install --name db-test stable/mariadb -f .values-production.yml --set rootUser.password=ROOT_PASSWORD --set replication.password=REPLICATION_PASSWORD --set initdbScriptsConfigMap=db-scheme
</code></pre>
<p>Here are the logs :</p>
<p><img src="https://user-images.githubusercontent.com/36083584/56321611-65442000-6167-11e9-97f2-d8136d64a741.png" alt="image" /></p>
<hr />
<h3>Edit2</h3>
<p>I created a folder named <code>files/docker-entrypoint-initdb.d</code></p>
<p>My current directory:</p>
<pre><code>.
├── values-production.yml
│
├── files
│   └── docker-entrypoint-initdb.d
│       └── db.sql
</code></pre>
<p>And run this command from the current directory:</p>
<pre><code>helm install --name test stable/mariadb -f .\values-production.yml --set rootUser.password=ROOT_PASSWORD --set replication.password=REPLICATION_PASSWORD
</code></pre>
<p>MariaDB boots up but without my SQL tables.</p>

<p>My issue is more complex than it seems :
<a href="https://github.com/bitnami/bitnami-docker-mariadb/issues/182" rel="nofollow noreferrer">https://github.com/bitnami/bitnami-docker-mariadb/issues/182</a></p>

<p>Something apart, creating a configmap does indeed work :</p>

<pre><code>kubectl create configmap db-scheme --from-file=db.sql

helm install --name db-test stable/mariadb -f .values-production.yml --set rootUser.password=ROOT_PASSWORD --set replication.password=REPLICATION_PASSWORD --set initdbScriptsConfigMap=db-scheme
</code></pre>
