https://rancher.com/ logo
Title
m

melodic-hamburger-23329

02/03/2023, 2:21 AM
Is there a way to automatically remove claimRef from PersistentVolume after PVC has been deleted? I’m trying to create a pool of reusable cache volumes, but the problem is that claimRef prevents reuse of PVs after pod and its PVC have been deleted.
n

narrow-egg-98197

02/03/2023, 9:47 AM
I found there a solution as reference from stackflow which mention to remove
clainRef
with
kubectl patch pv <pv-name> --type json -p '[{"op": "remove", "path": "/spec/claimRef"}]
Hope it can help you.
m

melodic-hamburger-23329

02/06/2023, 5:44 AM
@narrow-egg-98197 Thanks. Yea, I found about that approach too. However, it is very inconvenient as I would like to remove it automatically. Apparently there’s no such functionality in k8s 🤔
👀 1
n

narrow-egg-98197

02/08/2023, 9:05 AM
yeah, i also found there were related discussion here in the Kubernetes repository but seems there is no functional method to clean claimRef field to reuse the PVC.