【问题标题】:'kubectl cp' command doesn't copy the target directory but its contents'kubectl cp' 命令不会复制目标目录,而是复制其内容
【发布时间】:2022-01-06 19:40:23
【问题描述】:
 kubectl cp namespace/podname:/path/target .

如果我使用 kubernetes 指南中的指示命令,它只会复制 target 目录中的内容并省略 target 本身。
我不想每次需要复制时都使用mkdir
有什么选择?

【问题讨论】:

  • kubectl cp namespace/podname:/path/target ./target 这个怎么样?

标签: kubernetes kubectl


【解决方案1】:

试试kubectl cp namespace/podname:/path/target target。注意指定“./target”将收到警告:“tar:从成员名称中删除前导 '/'”。另外,请确保您的图像有tar 命令,否则kubectl cp 可能会失败。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-12-16
    • 1970-01-01
    • 2020-02-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-11
    相关资源
    最近更新 更多