1

I'd like to create a script to copy a batch of files from a folder in a Kubernetes pod to a local folder. Is there a way to loop through the files in the pod such that this would work?

for filename in my_pod:/src/app-data/temp/*.csv; 
    do echo filename;
done

This simply prints my_pod:/src/app-data/temp/*.csv, I think because it's not actually finding the directory I'm pointing it to. I've confirmed that the folder exists and the path is correct.

triphook
  • 2,915
  • 3
  • 25
  • 34
  • I believe you'll need to use `kubectl` to execute the command on the pod in which the filesystem resides. You could redirect that output to a file, and then loop that in your local script. It would look something like [this](https://stackoverflow.com/questions/48084476/kubectl-ls-or-some-other-way-to-see-into-a-pod). – JNevill May 16 '23 at 19:32

0 Answers0