Hi,

is it possible in any way to create a PVC / PV and link it to a currently existing, unbound volume, which was previously created via a Kubernetes cluster? If this would be possible, it would enable quick migration of huge datasets in case of severe cluster failures. Any documentation or planned work on that?

Dennis

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Dennis,

I needed a way to transfer data between separate clusters as well -the same use case as you described.

Instead of trying to create another PVC and get k8s/digitalocean link the existing target volume to it, I had the k8s pod refer to it via the ‘hostpath’ construct. ( https://kubernetes.io/docs/concepts/storage/volumes/#hostpath )

Steps:

  • Detach the volume from the droplet.
  • Attach it to the target droplet . This is the droplet ( node) that you will want to 'select’ in your k8s pod or deployment script.

Login to your droplet and mount it ( https://www.digitalocean.com/docs/volumes/how-to/mount/)

I assume you’ve mounted it under /mnt . ( will be referenced next)

  • Use the followin stanza in your k8s ( here it is a pod ) script:

    volumeMounts:

    • mountPath: /mnt name: restore-pv volumes:
    • name: restore-pv hostPath: path: /mnt
  • Finally, apply your script.

I hope that helps.

Submit an Answer