Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleting PVC doesn't free up PV for re-attaching #257

Closed
iguyking opened this issue Dec 20, 2021 · 2 comments
Closed

Deleting PVC doesn't free up PV for re-attaching #257

iguyking opened this issue Dec 20, 2021 · 2 comments

Comments

@iguyking
Copy link

What happened:

Created a PV with the NFS Driver pointing at an existing NFS server.

---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: test-pv
spec:
  capacity:
    storage: 1000Gi
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  mountOptions:
    - hard
    - nfsvers=4.1
  csi:
    driver: nfs.csi.k8s.io
    readOnly: false
    volumeHandle: test-media-shared-many
    volumeAttributes:
      server: 192.168.69.16
      share: /
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: test-pvc
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 10Gi
  volumeName: test-pv
  storageClassName: ""

When I deleted the PVC, kubectl get pvc showed that the PVC was removed.

The PV showed it as Released though it still has a Claim in it.

❯ kubectl get pv
NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS     CLAIM      STORAGECLASS    REASON   AGE
test-pv                                     1000Gi     RWX            Retain           Released   test-pvc                                      5h8m

Attempting to create a new PVC against this PV fails with the error:

❯ kubectl describe pvc test-claim
Name:          test-claim
Namespace:     default
StorageClass:
Status:        Pending
Volume:        test-pv
Labels:        <none>
Annotations:   <none>
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:      0
Access Modes:
VolumeMode:    Filesystem
Used By:       <none>
Events:
  Type     Reason         Age   From                         Message
  ----     ------         ----  ----                         -------
  Warning  FailedBinding  11s   persistentvolume-controller  volume "test-pv" already bound to a different claim.

What you expected to happen:

That since there is a clear PV, I can setup a new PVC to this PV.

How to reproduce it:

See info above.

Anything else we need to know?:
Installed the CSI Driver using the helm chart version 3.1.0, App Version: latest

Environment:

  • CSI Driver version: 3.1.0
  • Kubernetes version (use kubectl version): v1.21.2+vmware.1
  • OS (e.g. from /etc/os-release): VMware Photon version 3.0
  • Kernel (e.g. uname -a): 4.19.198-1.ph3 #1-photon SMP
  • Install tools: helm
  • Others:
@andyzhangx
Copy link
Member

that's expected behavior:
https://kubernetes.io/docs/concepts/storage/persistent-volumes/#retain
Retain
The Retain reclaim policy allows for manual reclamation of the resource. When the PersistentVolumeClaim is deleted, the PersistentVolume still exists and the volume is considered "released". But it is not yet available for another claim because the previous claimant's data remains on the volume. An administrator can manually reclaim the volume with the following steps.

Delete the PersistentVolume. The associated storage asset in external infrastructure (such as an AWS EBS, GCE PD, Azure Disk, or Cinder volume) still exists after the PV is deleted.
Manually clean up the data on the associated storage asset accordingly.
Manually delete the associated storage asset.
If you want to reuse the same storage asset, create a new PersistentVolume with the same storage asset definition.

@iguyking
Copy link
Author

Thanks. Sorry for the misunderstanding.

TerryHowe pushed a commit to TerryHowe/csi-driver-nfs that referenced this issue Oct 17, 2024
…idecar-e2e-path

chore: add CSI_PROW_SIDECAR_E2E_PATH
TerryHowe added a commit to TerryHowe/csi-driver-nfs that referenced this issue Oct 19, 2024
227577e Merge pull request kubernetes-csi#258 from gnufied/enable-race-detection
e1ceee2 Always enable race detection while running tests
988496a Merge pull request kubernetes-csi#257 from jakobmoellerdev/csi-prow-sidecar-e2e-path
028f8c6 chore: bump to Go 1.22.5
69bd71e chore: add CSI_PROW_SIDECAR_E2E_PATH

git-subtree-dir: release-tools
git-subtree-split: 227577e
TerryHowe added a commit to TerryHowe/csi-driver-nfs that referenced this issue Oct 19, 2024
227577e Merge pull request kubernetes-csi#258 from gnufied/enable-race-detection
e1ceee2 Always enable race detection while running tests
988496a Merge pull request kubernetes-csi#257 from jakobmoellerdev/csi-prow-sidecar-e2e-path
028f8c6 chore: bump to Go 1.22.5
69bd71e chore: add CSI_PROW_SIDECAR_E2E_PATH

git-subtree-dir: release-tools
git-subtree-split: 227577e
andyzhangx added a commit to andyzhangx/csi-driver-nfs that referenced this issue Oct 20, 2024
227577e Merge pull request kubernetes-csi#258 from gnufied/enable-race-detection
e1ceee2 Always enable race detection while running tests
988496a Merge pull request kubernetes-csi#257 from jakobmoellerdev/csi-prow-sidecar-e2e-path
028f8c6 chore: bump to Go 1.22.5
69bd71e chore: add CSI_PROW_SIDECAR_E2E_PATH

git-subtree-dir: release-tools
git-subtree-split: 227577e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants