简体   繁体   中英

How to copy files from pod in one namespace to pod in another namespace

Does kubectl provide a way to copy files from pod in one namespace to another? I see we can copy files from pod to local machine and then copy them on another pod of different namespace. But can we copy directly from one namespace to another?

I tried:

kubectl cp <namespace1>/<pod1>:/tmp/foo.txt <namespace2>/<pod1>:/tmp/foo.txt

Looking at kubectl cp command help options I don't think there is any way to do that.

Not really kubectl cp can only copy remote/local or local/remote, so unfortunately it's a 2 step process:

 $ kubectl cp <namespace1>/<pod1>:/tmp/foo.txt foo.txt
 $ kubectl cp foo.txt <namespace2>/<pod1>:/tmp/foo.txt

I would be nice to have a 1 step process, like rsync , but it is what it is as of this writing. I opened this issue to track it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM