<p>I found that creating a yaml object description using <code>--dry-run=client</code> and providing <code>--command</code> only works when the provided arguments are in a very specific order.</p>
<p>This works:</p>
<pre><code>k run nginx --image=nginx --restart=Never --dry-run=client -o yaml --command -- env &gt; nginx.yaml
</code></pre>
<p>This does NOT:</p>
<pre><code>k run nginx --image=nginx --restart=Never --command -- env --dry-run=client -o yaml &gt; nginx.yaml
</code></pre>
<p>I feel a bit confused because the version that does not work looks a lot more intuitive to me then the one that does work. Ideally both should work in my opinion. Is this intended behavior?  I can't find any documentation about it.</p>

Maximilian Jesch
<blockquote>
<p>Ideally both should work in my opinion.</p>
</blockquote>
<p>Unfortunately, the commands you presented are not the same. They will never work the same either. This is correct behaviour. <a href="https://unix.stackexchange.com/questions/11376/what-does-double-dash-mean">Double dash</a> (<code>--</code>) is of special importance here:</p>
<blockquote>
<p>a double dash (<code>--</code>) is used in most Bash built-in commands and many other commands to signify the end of command options, after which only positional arguments are accepted.</p>
</blockquote>
<p>So you can't freely swap &quot;parameters&quot; places. Only these options can be freely set</p>
<pre class="lang-yaml prettyprint-override"><code>--image=nginx --restart=Never --dry-run=client -o yaml --command
</code></pre>
<p>Then you have <code>-- env</code> (double dash, space, and another command). After <code>--</code> (double dash and space)  only positional arguments are accepted.</p>
<p>Additionally, <code>&gt;</code> is shell meta-character to set <a href="https://www.gnu.org/software/bash/manual/html_node/Redirections.html" rel="nofollow noreferrer">redirection</a>.</p>
