Kubectl exec命令将内容写入Pod中的文件 [英] Kubectl exec command to write contents to a file in the pod

查看:646
本文介绍了Kubectl exec命令将内容写入Pod中的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用命令

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

但是会引发错误

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

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

What is the best way to achieve this

推荐答案

发现了类似的问题

Found a similar question here and below command works now

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

这篇关于Kubectl exec命令将内容写入Pod中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆