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
- How Do I Expand the Storage Capacity of a Container?
- What Are the Differences Among CCE Storage Classes in Terms of Persistent Storage and Multi-node Mounting?
- Can I Create a CCE Node Without Adding a Data Disk to the Node?
- Can EVS Volumes in a CCE Cluster Be Restored After They Are Deleted or Expired?
- 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 Can I Achieve Compatibility Between ExtendPathMode and Kubernetes client-go?
- What Can 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?
- What Should I Do If a Yearly/Monthly EVS Disk Cannot Be Automatically Created?
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