Let's say that I have a pre-existing (retained) EBS volume that was created by a PVC/PV that has been deleted by mistake. This volume was created like this:
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: gp2-retain
parameters:
fsType: ext4
type: gp2
provisioner: kubernetes.io/aws-ebs
reclaimPolicy: Retain
allowVolumeExpansion: true
volumeBindingMode: Immediate
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app: prometheus
name: prometheus-server
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 8Gi
storageClassName: gp2-retain
volumeMode: Filesystem
and was used by a pod created by a helm chart with
helm install prometheus-current stable/prometheus server.persistentVolume.existingClaim=prometheus-server
So this EBS contains some files created by that pod that I want to keep. Now, we managed to delete the PVC/PV but the EBS volume was retained due to the reclaimPolicy.
So I want to recreate the PersistingVolumeClaim and PersistentVolume in a way that points to this particular EBS volumeID aws://eu-west-1/vol-xxxxx. How can created a PVC without triggering the dynamic provisioning and create a new PV backed by a completely new EBS
volume?