Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import existing volume #781

Open
jorikseldeslachts opened this issue Nov 12, 2024 · 1 comment
Open

Import existing volume #781

jorikseldeslachts opened this issue Nov 12, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@jorikseldeslachts
Copy link

jorikseldeslachts commented Nov 12, 2024

TL;DR

Is it possible to import an existing volume into the cluster and make it managed by the csi driver?

Expected behavior

Reuse an already existing volume in a new cluster.

@jorikseldeslachts jorikseldeslachts added the enhancement New feature or request label Nov 12, 2024
@lukasmetzner
Copy link
Contributor

Hey,

this is already possible. First, you should detach your volume from any server. Afterward, you need to find out your volume ID, which you can do in the Hetzner Cloud Console, or via hcloud volume list. This needs to be referenced in the volumeHandle of your PV definition. Then you can create a PVC and reference the existing PV via volumeName.

I will add some documentation for this process.

apiVersion: v1
kind: PersistentVolume
metadata:
  name: imported-data
spec:
  storageClassName: hcloud-volumes
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  csi:
    fsType: ext4
    driver: csi.hetzner.cloud
    volumeHandle: "102005585" # <-- insert volume id here

---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: imported-data
spec:
  storageClassName: hcloud-volumes
  volumeName: imported-data # <-- reference your volume name here
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants