This is an important step, once you launch your Python setup, you have to copy your data from your local laptop/Desktop to your Python pod. It can be done using the Windows Power shell. In this section, we will see how to copy the data from the local system to your remote pod and vice-versa.
Table of Contents
Things to Check
Before proceeding, you first need to check whether your pod is in running status or not. Also, you need to compress a folder using 7zip in tar format. Download 7zip software and create a tar file of the local folder you want to copy to the Kubernetes container pod.
First, you need to check whether your pod is active or not. Open Windows Powershell and check the status of your pod using kubectl command.
#Command sample kubectl describe pod podname
In our case, the pod name is sumit49670241-pytorch so the command is
kubectl describe pod sumit49670241-pytorch
Below is the output of the command
Using 7zip software compress the folder to the tar format you want to copy. Now, we are ready to proceed, and we will try to copy the tar file to the remote pod.
Copy file from local Laptop/Desktop to Remote Pod
Switch to the folder using Windows Powershell, in this example, the images.tar is placed in the directory “C:\Users\sumrak\Downloads\images”. Switch to the directory.
Run the kubectl command in the below format
#Sample format kubectl cp local_tar_file_path pod_name:directory_path #Sample Command Example kubectl cp .\images.tar sumit49670241-pytorch:/home/vscode/workspace/data
Note
Always copy the files inside folder /home/vscode, this is where the PVC storage is mounted.
Copy data from Remote Pod to local Laptop/Desktop
Now, we will copy the file from the remote pod to the local computer.
Run the kubectl command in the below format
#Sample format kubectl cp pod_name:filepath local_tar_file_path #Sample Command Example kubectl cp sumit49670241-pytorch:/home/vscode/workspace/data/images.tar .\images.tar