LoginSignup
0
1

More than 3 years have passed since last update.

kubectl cp がうまく行かない時に試すこと

Last updated at Posted at 2020-12-10

やりたいこと

podからlocal(host)へファイルをcpしたい。

でてきたエラー、警告

tar: xxx: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
tar: Removing leading `/' from member names

試すこと

絶対パス指定してみる
kubectl cp <pod>:/var/www/html/index.html ./index.html
絶対パス(先頭の"/"なし)にしてみる
kubectl cp <pod>:var/www/html/index.html ./index.html
WORKDIRにファイルを配置して、cpしてみる

ファイルをWORKDIR?(exec -it -- bashで入った時のパスの場所)にファイルを配置して、パスなしのファイル名だけでkubectl cp

操作例

> kubectl exec -it <pod> -- bash
> cp ./dir/other.html ./
> kubectl cp <pod>:other.html ./othe#r.html

参考

[k8s]kubectl copy が「tar: Removing leading `/' from member names」で失敗
kubernetesポッドからローカルシステムにファイルをコピーする方法
Kubectl cp gives "tar: removing leading '/' from member names" warning

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1