<p>I am bit confused with commands in kubectl. I am not sure when I can use the commands directly like</p>
<p><code>command: [&quot;command&quot;] or -- some_command</code></p>
<p>vs</p>
<p><code>command: [/bin/sh, -c, &quot;command&quot;] or -- /bin/sh -c some_command</code></p>

BrownTownCoder
<blockquote>
<p>I am bit confused with commands in kubectl. I am not sure when I can use the commands directly</p>
</blockquote>
<p>Thankfully the distinction is easy(?): every <code>command:</code> is fed into the <a href="https://en.wikipedia.org/wiki/Exec_(system_call)" rel="nofollow noreferrer"><code>exec</code> system call</a> (or its golang equivalent); so if your container contains a binary that the kernel can successfully execute, you are welcome to use it in <code>command:</code>; if it is a shell built-in, shell alias, or otherwise requires <code>sh</code> (or <code>python</code> or whatever) to execute, then you must be explicit to the container runtime about that distinction</p>
<p>If it helps any, the <code>command:</code> syntax of kubernetes <code>container:</code>s are the <em>equivalent</em> of <a href="https://docs.docker.com/engine/reference/builder/#entrypoint" rel="nofollow noreferrer"><code>ENTRYPOINT [&quot;&quot;,&quot;&quot;]</code></a> line of Dockerfile, not <code>CMD [&quot;&quot;, &quot;&quot;]</code> and for sure not <code>ENTRYPOINT echo this is fed to /bin/sh for you</code>.</p>
