Report this

What is the reason for this report?

How to mount new volume in Kubernetes Pod

Posted on January 10, 2021

I have a Velero backup going that produces volume snapshots of our production environment. Now I need to load and copy the data from one of these snapshots, in a test environment. Basically, I want to copy the state from production, but can’t do a full Velero restore. I created a volume from the snapshot and was asked to attach it to a droplet, so I chose one of the test K8s cluster’s nodes. This all seems fine, but I can’t figure out how to make this volume available to a pod. I have a test pod, which I can attach to the existing k8S volumes by setting it up with existing PersistedVolumeClaims. These are existing volumes created using PVCs. For the new volume, I tried to duplicate and modify the exists PVC, replacing the volume name/id with the one I configured in the DO web. Then I tried to start the pod with this configuration. However, K8s says the pod and the PVC failed because the PVC in “unbound” / “ClaimLost”. In any case, I guess the test pod must run on the cluster node where I assigned the volume.

Any advice on how to mount a new DO volume, containing restored data, onto a K8s pod?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

Hi there,

You’re right; you will need to create a PersistentVolume (PV) and a PersistentVolumeClaim (PVC) to make this volume accessible to your pods.

You can follow the steps here on how to add volumes to a Managed Kubernetes Clusters:

https://docs.digitalocean.com/products/kubernetes/how-to/add-volumes/

What I could also suggest is using the Snapshooter service which under the hood also uses Valero:

https://docs.digitalocean.com/developer-center/digitalocean-managed-kubernetes-backups-with-snapshooter/

Best,

Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.