【问题标题】:Kubectl exec command to write contents to a file in the podKubectl exec 命令将内容写入 pod 中的文件
【发布时间】:2018-08-17 18:26:18
【问题描述】:

我正在尝试以下命令

kubectl exec -it sss-pod-four  echo "hi" >> /mnt/sss/testnew.txt

但是会报错

-bash: /mnt/sss/testnew.txt: No such file or directory

实现这一目标的最佳方法是什么

【问题讨论】:

    标签: kubernetes exec kubectl


    【解决方案1】:

    发现一个类似的问题here 和下面的命令现在可以工作了

     kubectl exec -it sss-pod-four  -- bash -c "echo hi > /mnt/sss/testnew.txt" 
    

    【讨论】:

      猜你喜欢
      • 2017-02-20
      • 2018-04-10
      • 1970-01-01
      • 2020-11-17
      • 2020-06-11
      • 2010-10-13
      • 2022-12-16
      • 1970-01-01
      • 2016-06-12
      相关资源
      最近更新 更多