<p><strong>Short version:</strong> PostgreSQL deployed via Helm is persisting data between deployments unintentionally. How do I make sure data is cleared?</p>

<p><strong>Long version:</strong> I'm currently deploying PostgreSQL via Helm this way, using it for a local development database for an application I'm building:</p>

<pre><code>helm install stable/postgresql -n testpg \
    --set global.postgresql.postgresqlDatabase=testpg \
    --set global.postgresql.postgresqlUsername=testpg \
    --set global.postgresql.postgresqlPassword=testpg \
    --set global.postgresql.servicePort=5432 \
    --set service.type=LoadBalancer
</code></pre>

<p>When I'm done (or if I mess up the database so bad and need to clear it), I uninstall it:</p>

<pre><code>helm del --purge testpg
</code></pre>

<p>(which confirms removal and <code>kubectl get all confirms</code> works)</p>

<p>However, when I spin the database up again, I'm surprised to see that the data and schema are still there when it has spun up.</p>

<p><strong>How is the data persisting and how do I make sure I have a clean database each time?</strong></p>

<p>Other details:</p>

<ul>
<li>My Kubernetes Cluster is running in Docker Desktop v2.0.0.3</li>
</ul>

jeffmaher
<p>Your cluster may have a default volume provisioner configured.</p>

<p><a href="https://kubernetes.io/docs/concepts/storage/dynamic-provisioning/#defaulting-behavior" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/storage/dynamic-provisioning/#defaulting-behavior</a></p>

<p>So even if you have no storage class configured a volume will be assigned.</p>

<p>You need to set helm value persistence.enabled to false.</p>

<p>The value is true by default:</p>

<p><a href="https://github.com/helm/charts/blob/master/stable/postgresql/values.yaml" rel="nofollow noreferrer">https://github.com/helm/charts/blob/master/stable/postgresql/values.yaml</a></p>
