Reuse existing Hetzner Cloud Volume - csi-driver
Is it possible to reuse an existing Hetzner Cloud Volume?
Every new PVC creates a random/unique name/identifier, which is not based on the volume or PVC name, so in some cases I end up with duplicate volumes on Hetzner's side, which I then have to clean up manually.
This made me wonder if there's a name, identifier or annotation that I could utilize to ensure that the Persistent Volume name is set to a specific name every time, and whether the CSI driver would pick up on that, connecting the Hetzner Cloud Volume with the Kubernetes volume/volume claim?
5 Answer:
Just copy Volume ID and use it as volumeHandle - specify PV with
csi:
volumeHandle: "xxxxx"
driver: csi.hetzner.cloud
fsType: ext4
in you spec:
Thanks! While that sounds like it would indeed do what I want, it unfortunately sounds like wouldn't fit well into the infrastructure automation, eg. when the volume is first created/provisioned I would have to manually keep track of the volume handle/ID.
Unless the CSI driver syncs all Hetzner Cloud Volumes to Kubernetes as PVs, meaning I could automate the HCloud Volume part of it before creating the Kubernetes cluster, then using the name/ID of that?
Never mind, this did indeed work exactly as described! I simply created the Hetzner Cloud Volume in Terraform first, then passed the ID to the PV's volumeHandle, which worked perfectly.
I am sorry. Do you have a complete example for a pv definition with a given volumeHandle? I am new to kubernetes and I don't get it done.
- Do I have to create the volume in the hetzner cloud before I create the PC/PVC? And if so, do I have to attach thee volume to a hetzner server?
- And how exactly does a pv and pvc resourcee looks like with the snippet you pasted above?
I am thankful for any help, Tobias
Ok, I found my mistake. The volumeHandle must be its ID and not its name. It is bound now to my pod.
Read next
- cluster-api Incorrect etcd members remediation in KCP after controller failure. Go
- framework Redis Cache Tags Breaks With Read Only Replica PHP
- Add global action - PHP EasyAdminBundle
- Keka [BUG] Extractions queue ignores performance limits/maximums - PHP
- vue-test-utils Triggering click on a label for an element does not trigger click on that element - JavaScript
- nextdns Wildcard local domain resolution Go
- Connecting to schema registry 404 not found - kafkacat
- CDK depends on vulnerable version of pac-resolver - aws-cdk