I am trying to copy some files to a persistent volume that will be later on mounted on a pod. In the example I am looking at they use NFS PV and it is quite simple as I can access the NFS file system associated with a PV and I can add files to it. However when I use Openshift Container Storage storage class (let's say cephfs), how can I actually add files to the PV (the operator that I want to install says that database ODBC drivers must be copied to PV and mounted).
Thanks.
Mount the PV in a different pod, and "oc cp" the files in, or "oc rsh ..." and curl/wget/scp from inside the pod to the local volume mount.
On an existing pod, you can also create a sidecar container with, e.g, busybox to mount the same PV and provide file copy tools if they're not present in the primary container.
you can use the below command to copy files from local to ocp PV.
oc cp <source_path> <env_name>/<pod_name>:/<folder_name>/<sample_file>.<extension>
example : move to the folder from which you want to copy the file. let's say you have a test folder in which you have test.json that you want to copy so here would be the command.
cd test
oc cp . env1/pod1:/cepfs/test.json
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With