How to copy file from container in a pod in a specific namespace?
kubernetes
Solution
this works for me:
$(kubectl exec <pod-name> [-c <container-name>] -it -- cat <file-path>) > <local-file>
Problem
Say I have, my-namespace -> my-pod -> my-container and I have a file located at my-container:/opt/tomcat/logs/catalina.2017-05-02.log. I have applied the below command to copy the file which isn't working, ``` kubectl cp my-namepace/my-pod:/opt/tomcat/logs/catalina.2017-05-02.log -c my-container . ``` Note: I have the tar binary on my container Error: ``` tar: Removing leading `/' from member names error: open .: is a directory ```