I want to add or copy files into persistent volume and then use it in container using volume mount ?any help
Asked
Active
Viewed 7,410 times
3
-
Your question is too broad. Please refer K8S documentation for PV, SC and PVC https://kubernetes.io/docs/concepts/storage/persistent-volumes/#claims-as-volumes – Nataraj Medayhal Sep 17 '22 at 10:45
-
I have checked this doc but couldn't find any solution . I have created PV and PVC and now i have to copy a folder from my local machine to that persistent volume – Ameer khan Sep 18 '22 at 07:30
1 Answers
4
Once PVC/PV are created (https://kubernetes.io/docs/concepts/storage/persistent-volumes/), there are number of possible solutions.
For specific question, options 1 and 2 will suffice. Listing more for reference, however this list does not try to be complete.
- Simplest and native,
kubectl cp
: https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#cp rsync
- still quite simple, but also robust. Recommended for a task (both of below options were tested)
- TO pod: https://serverfault.com/questions/741670/rsync-files-to-a-kubernetes-pod
- FROM pod: https://cybercyber.org/using-rsync-to-copy-files-to-and-from-a-kubernetes-pod.html
tar
, but incremental: https://www.freshleafmedia.co.uk/blog/incrementally-copying-rsyncing-files-from-a-kubernetes-pod- Tools for synchronisation, backup, etc
- For example, https://github.com/backube/volsync

General Grievance
- 4,555
- 31
- 31
- 45

Aleksejs Spiridonovs
- 424
- 2
- 6