<p>I install the Bitnami Helm chart, using the example shown in the README:</p>
<pre class="lang-sh prettyprint-override"><code>helm install my-db \
  --namespace dar \
  --set postgresqlPassword=secretpassword,postgresqlDatabase=my-database \
  bitnami/postgresql
</code></pre>
<p>Then, following the instructions shown in the blurb which prints after the installation is successful I forward the port to port 5432 then try and connect:</p>
<pre><code>PGPASSWORD=&quot;secretpassword&quot; psql --host 127.0.0.1 -U postgres -d my-database -p 5432
</code></pre>
<p>But I get the following error:</p>
<pre><code>psql: error: could not connect to server: FATAL:  password authentication failed for user &quot;postgres&quot;
</code></pre>
<p>How can this be? Is the Helm chart buggy?</p>

<p>Buried deep in the <a href="https://github.com/helm/charts/issues/16251#issuecomment-564964236" rel="noreferrer">stable/postgresql issue tracker</a> is the source of this very-hard-to-debug problem.</p>
<p>When you run <code>helm uninstall ...</code> it errs on the side of caution and doesn't delete the storage associated with the database you got when you first ran <code>helm install ...</code>.</p>
<p>This means that once you've installed Postgres once via Helm, the secrets will always be the same in subsequent installs, regardless of what the post-installation blurb tells you.</p>
<p>To fix this, you have to manually remove the persistent volume claim (PVC) which will free up the database storage.</p>
<pre class="lang-sh prettyprint-override"><code>kubectl delete pvc data-my-db-postgresql-0
</code></pre>
<p>(Or whatever the PVC associated with your initial Helm install was named.)</p>
<p>Now a subsequent <code>helm install ...</code> will create a brand-new PVC and login can proceed as expected.</p>
