Interview Prep/Kubernetes/Storage and volumes

A PV shows `Released` after its PVC was deleted, and a new PVC cannot bind to it even though you want the old data.

IntermediateTroubleshootingStorage and volumes
Answer

Likely causes → With persistentVolumeReclaimPolicy: Retain, the PV keeps a claimRef to the deleted PVC's UID and will not bind to anything else.

Diagnose →

kubectl get pv pvc-7a2b -o jsonpath='{.status.phase} {.spec.claimRef}{"\n"}'

Fix → Clear the stale claim reference, then create a PVC that requests this PV explicitly:

kubectl patch pv pvc-7a2b --type=json -p '[{"op":"remove","path":"/spec/claimRef"}]'
spec:
  volumeName: pvc-7a2b
  storageClassName: gp3
  resources: {requests: {storage: 100Gi}}

Prevent → Retain on production data classes, and a documented re-bind procedure.

All Kubernetes questions Roadmap: Kubernetes networking, storage & scaling

More on Storage and volumes