Why Cannot I Delete a PV or PVC Using the kubectl delete Command?
Symptom
An existing PV or PVC cannot be deleted by running the kubectl delete command and it remains in the terminating state.
Possible Causes
To prevent data loss caused by mis-deletion of PVs or PVCs, Kubernetes provides a data protection mechanism. A PV or PVC cannot be directly deleted using the kubectl delete command.
Solution
Run the kubectl patch command first to remove the protection mechanism and then delete the PV or PVC.
If you have run kubectl delete to delete a PV or PVC, the PV or PVC remains in the terminating state. It will be directly deleted after you run the kubectl patch command.
- Run the following command to delete a PV:
kubectl patch pv <pv-name> -p '{"metadata":{"finalizers":null}}' kubectl delete pv <pv-name>
- Run the following command to delete a PVC:
kubectl patch pvc <pvc-name> -p '{"metadata":{"finalizers":null}}' kubectl delete pvc <pvc-name>
Storage FAQs
- What Are the Differences Among CCE Storage Classes in Terms of Persistent Storage and Multi-node Mounting?
- Can I Add a Node Without a Data Disk?
- Can I Restore an EVS Disk Used as a Persistent Volume in a CCE Cluster After the Disk Is Deleted or Expires?
- What Should I Do If the Host Cannot Be Found When Files Need to Be Uploaded to OBS During the Access to the CCE Service from a Public Network?
- How Many Nodes (ECSs) Can an SFS File System Be Mounted to?
- How Can I Achieve Compatibility Between ExtendPathMode and Kubernetes client-go?
- What Should I Do If a Storage Volume Fails to Be Created?
- Can CCE PVCs Detect Underlying Storage Faults?
- An Error Is Reported When the Owner Group and Permissions of the Mount Point of the SFS 3.0 File System in the OS Are Modified
- Why Cannot I Delete a PV or PVC Using the kubectl delete Command?
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbotmore