@kubernetes/sig-cli-feature-requests
—
You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
Something I found is that if I do not put a /
at the beginning of my path following :
in <pod>:<path>
that the kubectl cp command works fine.
I tried your suggestion to drop the leading slash like this:
kubectl cp cms-sw-one-6bf986b657-65vbn:home/cms/tomcat/logs ~/documents -c cms --namespace=od'
This gives the following error:
stderr: tar: home/cms/tomcat/logs: Cannot stat: No such file or directory
With the leading / it works fine except for the warning.
You may try to copy your files to workdir and then retry to copy them using just their names. It's weird, but it works for now.
I have the same problem, to solve this, I used the advice @kchugalinskiy gave.
I moved the wanted file to the working dir in the pod (the directory which is automatically opened, when you open bash on it) -
user@podname:/usr/src# ls data.txt data.txt
In my case it is - /usr/src
folder.
Then in my local bash terminal -
user@local:~$ kubectl cp podname:data.txt data.txt user@local:~$ ls data.txt data.txt
I'm receiving the same error message, but also finding the file copied correctly from the container to my local machine.
I'm not sure where to add the tar -C
flag when using kubectl cp
.
$ ll total 0 $ kubectl cp web-6fc578559d-sns6p:/usr/share/httpd/noindex/index.html ./new tar: Removing leading `/' from member names $ echo $? 0 $ cat new | head -10 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Apache HTTP Server Test Page powered by CentOS</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <!-- Bootstrap --> <link href="/noindex/css/bootstrap.min.css" rel="stylesheet"> <link rel="stylesheet" href="noindex/css/open-sans.css" type="text/css" /> <style type="text/css"><!--
it's not an error some condition since the exit code is 0
. Also the functionality works fine, it's just the error which comes which is kinda confusing.
And this is anwered in multiple places on stackoverflow, https://stackoverflow.com/a/25929424 and https://unix.stackexchange.com/a/59244
I would think this is not a bug, it's just what we expect and should not break any functionality.
It works fine but the message is just confusing.
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale
.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close
.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten
.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close
.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten
Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen
.
Mark the issue as fresh with /remove-lifecycle rotten
.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close
@fejta-bot: Closing this issue.
In response to this:
Rotten issues close after 30d of inactivity.
Reopen the issue with/reopen
.
Mark the issue as fresh with/remove-lifecycle rotten
.Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
Closed #58692.
i cannot copy the file anywhere else. permission issue.
is there another workaround?
@tuananh can you please provide the steps you are performing and what errors do you see? Please elaborate on what you are trying to achieve?
@surajssd im trying to get redis dump from container to my machine using this command
kubectl cp dev/redisdev-master-0:/bitnami/redis/data/dump.rdb ~/dump.rdb
I'm getting the above error
tar: Removing leading `/' from member names
@tuananh was the file copied successfully if yes then this is not really an error. If not then there could be other issues. See #58692 (comment) for more info
The error reason is kubectl cp
not use right pod file path.
example:
Pod WORKDIR set '/var/www/html'
if you want copy /var/www/html/foo.log
to your location file folder
you will run kubectl cp POD_NAME:foo.log /Users/foo/foo.log
, it work ok,
if run kubectl cp POD_NAME:/var/www/html/foo.log /Users/foo/foo.log
will get warning.
When i in c: run
kubectl cp backend-68c49589fb-7dkkm:/fileStorage/20191231/cd28206c5e654390a815cc03bbc6d14e.png d:/xxx.jpg
error:
tar: Removing leading `/' from member names
remove the / after pod: like
kubectl cp backend-68c49589fb-7dkkm:fileStorage/20191231/cd28206c5e654390a815cc03bbc6d14e.png d:/xxx.jpg
it's ok.
—
You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
@wangrqsh The issue has nothing to do with the drives on your local Windows computer. The latter works for you because the WORKDIR
in your pod is /
. Try setting a different WORKDIR
in your pod, and you will also experience the warning.
Saw the message trying to copy files out of a Pod. Didn't think to actually check the file system until I saw the suggestion from @AnthonyWC:
It works fine but the message is just confusing.
Looks like the message is just a warning that isn't squelched. Probably.
this should probably be reopened
Why this issue should be closed solely because it's not a serious bug or error is baffling. It is obviously a very real and annoying issue of usability given how many people have complained about it. Asking people to copy/move the file into the WORKDIR
first is not a solution—I could just as easily ignore the warning in the first place.
If an output message is confusing and serves no informational purpose to the user, then it should be suppressed by default—asking the operator to > /dev/null
is not a solution, either.
Hi ! I want to pick this up. Can suppress the warning which is very concussing for the users.
/reopen
@joshi95: You can't reopen an issue/PR unless you authored it or you are a collaborator.
In response to this:
/reopen
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
—
I have this exact same issue.
what I found was the repeatedly executing the command eventually works (like 1 success out of 5-10 failures)
it's weird, probably has to due with the enveloping Linux environment, and to make matters worse: when the command DO work, it doesn't actually create the copied file anywhere....
I eventually gave up and simply copy-pasted the file's content
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are on a team that was mentioned.
you can use command like this to avoid "tar: removing leading '/' from member names)" error
kubectl exec -c ${containerPod} -n ${namespace} ${podName} -- sh -c "cd /data/ && tar cf - config.yml" | tar xf - -C /home/ubuntu/
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are on a team that was mentioned.
As a workaround, I piped the output to sed and removed this useless message.
| sed -r "s/tar: removing leading '/' from member names//"
I don't want to suppress all output. It can contain useful messages but I just don't want to see this one. Especially if you write a bash script, it floods your screen.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are on a team that was mentioned.