How do I rebind a PV when PVC gets re instated?

TLDR; Persistent Volume Claim cannot remember its previously bound Persistent Volume after being redeployed(the PVC), despite being unchanged.

Lets say i have PV named my-pv and a pvc named my-pvc.

When i deploy them together with no existing pv result is OK, and my-pvc is bound to my-pv.

But when i delete my-pvc either directly or via deleting the namespace it resides in and then re deploy my-pvc, my-pvc gets stuck at pending and outputs volume "my-pv" already bound to a different claim.

Oddly though, my-pv seems to detect and accept accept the newly redeployed my-pvc.

linode-blockstorage-csi-driver : 0.4.0
linode PAT secret : already installed and verified to work.
kubernetes: 1.19.8
Helm: 3

My current work around:

  1. Edit PV in kubectl, delete entire claimRef.
  2. PV now transitions from Released to Available.
  3. New instance of PVC, binds.
  4. I don't think this is the right way to do it.
apiVersion: v1
kind: PersistentVolume
metadata:
  name: my-pv
spec:
  accessModes:
    - ReadWriteOnce
  capacity:
    storage: 20Gi
  csi:
    driver: linodebs.csi.linode.com
    fsType: ext4
    volumeHandle: <MY_VOLUME_ID>-<MY_VOLUME_LABEL>
  persistentVolumeReclaimPolicy: Retain
  storageClassName: linode-block-storage-retain
  volumeMode: Filesystem

---

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name:  my-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 20Gi
  storageClassName: linode-block-storage-retain
  volumeMode: Filesystem
  volumeName: my-pv

1 Reply

Linode Staff

Hi there -

I looked into this with our LKE team, and this looks like it's an issue we'll need to fix on our end as we were able to reproduce the issue you're having.

We have also tested out your workaround, and it worked for us as well. I recommend using that until the fix is implemented.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct