3

I want to add or copy files into persistent volume and then use it in container using volume mount ?any help

Ameer khan
  • 49
  • 1
  • 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 Answers1

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.

  1. Simplest and native, kubectl cp: https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#cp
  2. rsync - still quite simple, but also robust. Recommended for a task (both of below options were tested)
  1. tar, but incremental: https://www.freshleafmedia.co.uk/blog/incrementally-copying-rsyncing-files-from-a-kubernetes-pod
  2. Tools for synchronisation, backup, etc
General Grievance
  • 4,555
  • 31
  • 31
  • 45