21

I am trying below command

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

But it throws error

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

What is the best way to achieve this

ambikanair
  • 4,004
  • 11
  • 43
  • 83

1 Answers1

37

Found a similar question here and below command works now

 kubectl exec -it sss-pod-four  -- bash -c "echo hi > /mnt/sss/testnew.txt" 
ambikanair
  • 4,004
  • 11
  • 43
  • 83