<p>TL;DR. I'm lost as to how to access the data after deleting a PVC, as well as why PV wouldn't go away after deleting a PVC.</p>

<p>Steps I'm taking:</p>

<ol>
<li><p>created a disk in GCE manually:</p>

<pre><code>gcloud compute disks create --size 5Gi disk-for-rabbitmq --zone europe-west1-b
</code></pre></li>
<li><p>ran:</p>

<pre><code>kubectl apply -f /tmp/pv-and-pvc.yaml
</code></pre>

<p>with the following config:</p>

<pre><code># /tmp/pv-and-pvc.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv-for-rabbitmq
spec:
  accessModes:
  - ReadWriteOnce
  capacity:
    storage: 5Gi
  gcePersistentDisk:
    fsType: ext4
    pdName: disk-for-rabbitmq
  persistentVolumeReclaimPolicy: Delete
  storageClassName: standard
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-for-rabbitmq
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
  storageClassName: standard
  volumeName: pv-for-rabbitmq
</code></pre></li>
<li><p>deleted a PVC manually (on a high level: I'm simulating a disastrous scenario here, like accidental deletion or misconfiguration of a <code>helm</code> release):</p>

<pre><code>kubectl delete pvc pvc-for-rabbitmq
</code></pre></li>
</ol>

<p>At this point I see the following:</p>

<pre><code>$ kubectl get pv
NAME              CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS     CLAIM                      STORAGECLASS   REASON   AGE
pv-for-rabbitmq   5Gi        RWO            Delete           Released   staging/pvc-for-rabbitmq   standard                8m
$
</code></pre>

<blockquote>
  <p>A side question, just improve my understanding: <strong>why PV is still there, even though it has a reclaim policy set to <code>Delete</code>?</strong> Isn't this what the <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#delete" rel="noreferrer">docs</a> say for the <code>Delete</code> reclaim policy?</p>
</blockquote>

<p>Now if I try to re-create the PVC to regain access to the data in PV:</p>

<pre><code>$ kubectl apply -f /tmp/pv-and-pvc.yaml
persistentvolume "pv-for-rabbitmq" configured
persistentvolumeclaim "pvc-for-rabbitmq" created
$
</code></pre>

<p>I still get this for <code>pv</code>s, e.g. a PV is stuck in <code>Released</code> state:</p>

<pre><code>$
kubectl get pv
NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS     CLAIM                             STORAGECLASS   REASON    AGE
pv-for-rabbitmq                            5Gi        RWO            Delete           Released   staging/pvc-for-rabbitmq          standard                 15m
$
</code></pre>

<p>...and I get this for <code>pvc</code>s:</p>

<pre><code>$
kubectl get pvc
NAME               STATUS    VOLUME            CAPACITY   ACCESS MODES   STORAGECLASS   AGE
pvc-for-rabbitmq   Pending   pv-for-rabbitmq   0                         standard       1m
$
</code></pre>

<p>Looks like my PV is stuck in <code>Released</code> status, and PVC cannot access the PV which is not in <code>Available</code> status.</p>

<p>So, why the same PV and PVC cannot be friends again? <strong>How do I make a PVC to regain access to data in the existing PV?</strong></p>

oldhomemovie
<pre><code>kubectl patch pv pv-for-rabbitmq -p '{"spec":{"claimRef": null}}'
</code></pre>

<p>This worked for me.</p>
