<p>I deployed a PVC, which dynamically created a PV.
After that I deleted the PVC and now my PV looks like below:</p>
<pre><code>PS Kubernetes&gt; kubectl get pv
NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS     CLAIM            STORAGECLASS   REASON   AGE
pvc-1b59942c-eb26-4603-b78e-7054d9418da6   2G         RWX            Retain           Released   default/db-pvc   hostpath                26h
</code></pre>
<p>When I recreate my PVC, that creates a new PV.
Is there a way to reattach the existing PV to my PVC ?
Is there a way to do it automatically ?</p>
<p>I tried to attach the PV with my PVC using &quot;volumeName&quot; option, but it did not work.</p>
<pre><code>NAME      STATUS    VOLUME                                    CAPACITY   ACCESS MODES   STORAGECLASS   AGE
db-pvc    Pending   pvc-1b59942c-eb26-4603-b78e-7054d9418da6   0                         hostpath       77s
</code></pre>

<p>When a PVC is deleted, the PV stays in the &quot;Released&quot; state with the claimRef uid of the deleted PVC.</p>
<p>To reuse a PV, you need to delete the claimRef to make it go to the &quot;Available&quot; state</p>
<p>You may either edit the PV and manually delete the claimRef section, or  run  the patch command as under:</p>
<pre><code>kubectl patch pv pvc-1b59942c-eb26-4603-b78e-7054d9418da6 --type json -p '[{&quot;op&quot;: &quot;remove&quot;, &quot;path&quot;: &quot;/spec/claimRef&quot;}]'
</code></pre>
<p>Subsequently, you recreate the PVC.</p>
