Restore/bind a deleted dynamically provisioned PV/PVC

Is there an easy automated workflow possible to restore deleted volumes and reuse them when doing a workload or cluster rebuild.

I use Ansible to provision my workloads and accompanying storage with dynamically provisioned storage on Longhorn (1.6.1). If - for testing purposes - I take the following steps:

  1. Create a dynamically provisioned PVC, named config-pvc, which gets a volume named pvc-41d41cb5-3570-42ef-8beb-6b702cbf17e4.
  2. Create a Deployment and bind the PVC config-pvc to the Pod.
  3. Create a snapshot and backup of the volume.
  4. Delete the Deployment (to simulate cluster rebuild).
  5. Delete the dynamically provisioned volume pvc-41d41cb5-3570-42ef-8beb-6b702cbf17e4 (in the Longhorn UI).
  6. Restore the backup and use the same volume name.
  7. Create the Deployment again with the PVC config-pvc.
  8. A new Volume is created with a new name.

I understand I can manually override this behavior when recreating the workload, but I don’t see how I can include that in an automated deployment using Ansible (or a GitOps solution like Fleet for that matter).

I guess you can USE the CSI VolumeSnapshot feature instead. See Longhorn | Documentation for details.