<p>I am trying to execute <code>curl</code> command with <code>kubectl</code> like </p>

<pre><code>kubectl exec POD_NAME "curl -X PUT http://localhost:8080/abc -H \"Content-Type: application/json\" -d '{\"name\":\"aaa\",\"no\":\"10\"}' "
</code></pre>

<p>Gives belob error</p>

<pre><code>OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: \"kubectl exec POD_NAME "curl -X PUT http://localhost:8080/abc -H \"Content-Type: application/json\" -d '{\"name\":\"aaa\",\"no\":\"10\"}'\": 
stat kubectl exec POD_NAME "curl -X PUT http://localhost:8080/abc -H \"Content-Type: application/json\" -d '{\"name\":\"aaa\",\"no\":\"10\"}' ": no such file or directory" 
:unknown command terminated with exit code 126
</code></pre>

<p>I have tried to escape the quotes but no luck. Then I tried simple curl </p>

<pre><code>kubectl exec -it POD_NAME curl http://localhost:8080/xyz
</code></pre>

<p>This gives proper output as excepted. Any help with this </p>

<p>Update: </p>

<p>But when I run interactive (<code>kubectl exec -it POD_NAME /bin/bash</code>) mode of container and then run the curl inside the container works like champ</p>

Hitesh Ghuge
<p>i think you need to do something like this:</p>

<pre><code>kubectl exec POD_NAME curl "-X PUT http://localhost:8080/abc -H \"Content-Type: application/json\" -d '{\"name\":\"aaa\",\"no\":\"10\"}' "
</code></pre>

<p>what the error suggests is that its trying to interpret everything inside <code>""</code> as a single command, not as a command with parameters. so its essentially looking for an executable called that</p>
