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:
- Create a dynamically provisioned PVC, named config-pvc, which gets a volume named
pvc-41d41cb5-3570-42ef-8beb-6b702cbf17e4
. - Create a Deployment and bind the PVC
config-pvc
to the Pod. - Create a snapshot and backup of the volume.
- Delete the Deployment (to simulate cluster rebuild).
- Delete the dynamically provisioned volume
pvc-41d41cb5-3570-42ef-8beb-6b702cbf17e4
(in the Longhorn UI). - Restore the backup and use the same volume name.
- Create the Deployment again with the PVC
config-pvc
. - 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).