safetyduck
safetyduck

Reputation: 6834

How can we run a command with arguments on a pod using kubectl?

For example something like this should work but gives some errors. It seems like arguments need to be single no argument calls?

kubectl exec --stdin --tty pod 'cat myfile.txt'

Upvotes: 0

Views: 436

Answers (1)

cam
cam

Reputation: 5198

Seems like it's is missing the -- before the command. From these docs for reference:

kubectl exec pod  --stdin --tty -- cat myfile.txt

But the usage for kubectl does show you can have have a command like that:

 kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]

Upvotes: 2

Related Questions