It seems that Storage classes uses the provisioner to create a new volume. How about reusing an existing one? I don’t see any way to specify a Volume-ID for the AWS provisioner.
I’m 99% sure you cannot do this with a Storage Class. The
kubernetes.io/aws-ebs provisioner does not have a field that lets you specify an exiting volume – obviously the whole idea of them is creating volume dynamically. I’m also not aware of the PVC object having a way to do this. It basically calls on a Storage Class (provisioner) and can set things like access mode and capacity, but not a specific volume.
Hi Christian. Howe about trying this.
Configure your Storage Classes etc as normal. But for this requirement that needs a specific volume, manually create a PersistentVolume (PV) and then a claim on it (PVC). The PV definition below should give you a starting place and you can put in your own values as required…
apiVersion: v1 kind: PersistentVolume metadata: name: pv1 spec: accessModes: - ReadWriteOnce capacity: storage: 20Gi persistentVolumeReclaimPolicy: Retain awsElasticBlockStore: volumeID: <your-id-in-here> # This is the `vol-...` bit shown in the AWS console
I’ve not tested it, but something you might be able to test yourself and report back…