<p>I'm trying to modify kubernetes-dashboard deployment with patch command. I need to add "- --enable-skip-login" arg to containers section with one command.
Something like that:</p>

<pre><code>kubectl -n kube-system patch deployment kubernetes-dashboard --patch '{"spec":{"template":{"spec":{"containers":{"- args":{"- --enable-skip-login"}}}}}}'
</code></pre>

<p>But this doesn't work and I need right syntax to add this arg in the deployment yaml.</p>

<p><code>containers</code> and <code>args</code> are arrays so in JSON the representation would be this:</p>

<pre><code>{
  "spec": {
    "template": {
      "spec": {
        "containers": [
          { 
            "name", "yourcontainername",
            "args": [
              "--enable-skip-login"
            ]
          }
        ]
      }
    }
  }
}
</code></pre>

<p>So, you can try:</p>

<pre><code>$ kubectl -n kube-system patch deployment kubernetes-dashboard --patch \
'{"spec":{"template":{"spec":{"containers":[{"name": "yourcontainername","args": ["--enable-skip-login"]}]}}}}'
</code></pre>

<p>Note that you need <code>"name"</code> since it's a merge key. More info <a href="https://kubernetes.io/docs/reference/kubectl/cheatsheet/#patching-resources" rel="nofollow noreferrer">here</a></p>

<p>(answer was corrected in section):  </p>

<pre><code>"name",  "yourcontainername" 
</code></pre>
