<p>We're trying run a PostgreSQL in a minikube (1.18.1) Kubernetes (1.16.15) cluster so that the database is reset on every pod redeployment.</p>
<p>In our deployment template, we have:</p>
<pre class="lang-yaml prettyprint-override"><code>containers:
- name: mock-db  
  image: postgres:13
  imagePullPolicy: &quot;IfNotPresent&quot;
  ports:
    - name: postgres
      containerPort: 5432
  volumeMounts:
    - mountPath: /docker-entrypoint-initdb.d
      name: postgresql-init
    - mountPath: /var/lib/postgresql/data
      name: postgresql-data
volumes:
- name: postgresql-init
  configMap:
    name: &quot;mock-db-init-scripts&quot;
    optional: false
- name: postgresql-data
  emptyDir:
    medium: Memory
</code></pre>
<p>Based on the <a href="https://kubernetes.io/docs/concepts/storage/volumes/#emptydir" rel="nofollow noreferrer">docs</a>, this should work as intended:</p>
<blockquote>
<p>When a Pod is removed from a node for any reason, the data in the emptyDir is deleted permanently.</p>
</blockquote>
<p>However, after <code>helm uninstall</code> and subsequent <code>helm upgrade --install</code>, I'm getting this in the container logs:</p>
<pre><code>PostgreSQL Database directory appears to contain a database; Skipping initialization
</code></pre>
<p>So apparently, that volume is <em>not</em> being cleared. Why? Do I need to change something in the configuration?</p>

Raphael
<p>Here is what I missed:</p>
<ul>
<li>the init script failed and</li>
<li>the container immediately restarted.</li>
</ul>
<p>No problem with the volume, at all.</p>
