kubectl cp namespace/podname:/path/target .
If I use the instructed command from kubernetes guide, it only copies the contents inside the target
directory and omits target
itself.
I don't want to use mkdir
every time I need to copy.
What's the option?
CodePudding user response:
Try kubectl cp namespace/podname:/path/target target
. Note specify "./target" will receive a warning: "tar: removing leading '/' from member names". Also, ensure your image have tar
command or kubectl cp
can fail.