The issue
Whilst working on a Kubernetes project for a customer, the onsite support reported he failed to run pod on the cluster. after checking the pod log, the PVC didn’t exist, however, onsite support insisted he has applied the FTP PVC YAML file.
After investigating, I noticed that one PVC was stuck in “terminating” status for quite a while. I didn’t save the actual problem PVC screenshot. The below screenshot is an example.
The Cause
I had a quick google and found I needed to verify if the PVC is still attached to a node in the cluster
kubectl get volumeattachment
There was no PV attached to the PVC
The Fix
I needed to set the “finalizers” setting to null for ftp-storage PVC, this allows the final unmount from the node, and the PVC can be deleted. we can use patch
command or edit PVC directly.
kubectl patch pvc {PVC_NAME} -p '{"metadata":{"finalizers":null}}'
or
kubectl edit pvc ftp-storage
Summary
This is a common problem, if you search google, you will find a lot of similar questions and GitHub issues. you’d better backup your data before deleting PVC.