Unable to delete backend Azure disk after accidently first deleting the PV in ARO
Environment
- Azure Red Hat OpenShift [ARO]
- 4.x
Issue
- The
PVwas deleted first instead ofPVC, which left behind the backend Azure disk. - The backend disks in Azure cannot be manually deleted due to
Deny Assignmentthat is configured by design. - Can't delete the disks from Azure as the
Deny Assignmenton ARO Cluster resource group is preventing it.
Resolution
- It is not recommended to force deleting resources in general. It can result in situations where resources may not exist in OpenShift, but they still exist in the Cloud infrastructure.
-
In order to have the backend Azure disks deleted, please follow the steps below:
-
Create a new
PVby using the attached file 'pv.yaml' as a reference. Make sure you provide the correct Azure Disk details, and also thepersistentVolumeReclaimPolicyas 'Delete'.$ oc create -f pv.yaml -
Check that the
PVis created and is in phase 'Available', referencing the right disk.$ oc get pv -
Create a new
PVCby using the the attached file 'pvc.yaml' as a reference.$ oc create -f pvc.yaml -
Check that the
PVCis well created and that thePVis now in phase 'Bound'.$ oc get pvc -n <namespace> -
Delete the new
PVCcreated.$ oc delete pvc <pvc_name> -n <namespace> -
Check that the
PVC,PVand Disk are deleted altogether.
-
Root Cause
- Typically,
PVCsshould be deleted first, thenkube-controller-managerwould perform the appropriate steps to delete the relatedPVfollowing the disk, ensuring that thePVCis not in use before actually deleting it. Deleting thePVbefore thePVCresults in the corresponding Azure disk never being deleted. - In ARO, we have a
Deny Assignmentin place by design to prevent actions taken by users from impacting the health of the cluster (such as deleting or modifying a VM, disk, load balancer, NSG, etc.). This prevents from deleting the disks manually.
Diagnostic Steps
- Confirm that the
PVandPVCare not available for the related Azure disk, which is still online, but detached:
$ oc get pv <pv_name>
$ oc get pvc <pvc_name> -n <namespace>
Attachments
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments