<p>I tried multiple syntax including one given below , no luck yet</p>
<pre><code>kubectl exec  -u root -it testpod -- bash
Error: unknown shorthand flag: 'u' in -u
See 'kubectl exec --help' for usage.
</code></pre>
<p>it is version 1.22</p>

<ul>
<li>There is no option available in <code>kubectl exec</code> to mention the user</li>
<li>Because it is decided at either in the container image or in the pod.spec.containers.securityContext.runAsUser field</li>
<li>so to achieve what youy want is on a running container then do just <code>kubectl exec   -it testpod -- bash </code> and then issue <code>su - root</code> from inside the container</li>
</ul>
