Backups Stuck in 'Deleting' State in Velero on Automation Suite

How to address the issue of backups getting stuck in the 'Deleting' state within Velero on Automation Suite?


Issue:

In Velero on Automation Suite, an issue may arise where backups linger indefinitely in a 'Deleting' state. This problem commonly occurs due to the presence of orphaned snapshots, which are snapshots existing in the system without any current backups associated. These orphaned snapshots hinder the regular deletion process of backups, causing them to remain visible and consume resources without being accessible for user operations.

Resolution:

To effectively address this issue and ensure the deletion of all backups stuck in the 'Deleting' state, you can use the following script located in the '/opt/UiPathAutomationSuite/Installer/bin' directory:

for backup in $(./velero backup get | grep "Deleting" | awk '{print $1}'); do
    kubectl delete backups.velero.io -n velero $backup
done

This script automates the deletion process through the following steps:

  1. Retrieve a list of all backups currently in the 'Deleting' state using the Velero command line tool.
  2. Filtering this list to isolate the names of the backups.
  3. Iteratively passing each backup name to the kubectl delete command, forcing the deletion of these stuck backups within velero namespace.