<p>I currently install my Postgresql databases on my Kubernetes cluster like</p>
<pre><code>helm repo add bitnami https://charts.bitnami.com/bitnami
helm install my-release bitnami/postgresql
</code></pre>
<p>respectively</p>
<pre><code>helm repo add bitnami https://charts.bitnami.com/bitnami
helm install my-release bitnami/postgresql-ha
</code></pre>
<p>However, when I uninstall it resp. update it, then the PV resp. PVC and all its associated data are lost.</p>
<p>Is there some good way to handle the storage such that I do not have to worry to accidentally delete it or such that I can use the storage for an updated version of the chart.</p>
<p>Many thanks for you support!</p>

tobias
<p>The <a href="https://github.com/bitnami/charts/tree/master/bitnami/postgresq" rel="nofollow noreferrer">bitnami helm chart for postgres</a> provides several options to configure the persistence. The two values that are potentially useful in this scenario are.</p>
<ol>
<li><p><code>persistence.existingClaim</code> where you can point at an existing <code>PersistentVolumeClaim</code>. If you use this option, you also need to create the <code>PersistentVolume</code> it's claiming.</p>
</li>
<li><p><code>persistence.selector</code> which is used to let helm create the <code>PersistentVolumeClaim</code> but select an existing <code>PersistentVolume</code>.</p>
</li>
</ol>
<p>If you choose to use either one of them, you decouple your volume and potentially even the claim from the helm release. So, you have to create them by other means and helm will not manage their lifecycle. Therefore they would not get deleted on something like a <code>helm uninstall</code>.</p>
<p>That said, from my experience, in many cases helm won't delete volumes anyway when doing an uninstallation. I have no experience with the Bitnami Postgres chart. So I can't confirm if this is the case here. You may want to test.</p>
<p>You can read more about the <a href="https://github.com/bitnami/charts/tree/master/bitnami/postgresql#postgresql-parameters" rel="nofollow noreferrer">helm values here</a>. And you can find documentation on <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes" rel="nofollow noreferrer">volumes and claim here</a>.</p>
