Is there a way to reuse the EBS volumes, that are dynamically provisioned by the AWS EBS CSI driver, after destroying and recreating the EKS cluster? It is not possible to set a static value for the CSIVolumeName tag. So, is there any other way?
How to reuse dynamically provisioned EBS volumes with AWS EBS CSI driver after recreating EKS cluster?
690 views Asked by Kuppuswamy At
1
No, there is not a direct way due to the reason mentioned in the comment. But there is a solution to this. Solution: Create a Lambda, that uses AWS SDK to fetch the required dynamically provisioned EBS volumes, that are to be reused, and creates
PersistentVolumeswithclaimRefusing the tags present in the fetched EBS volumes. In this way, theclaimRefwill have the name of the previously createdPersistentVolumeClaimas its value. And when thePersistentVolumeClaimsare recreated after EKS cluster recreation, this Lambda gets executed, thePersistentVolumesget created, thePersistentVolumeClaimsare automatically mapped to thosePersistentVolumeswith their names in theclaimRef.