<p>In <code>Pod</code> specification, there is an option to specify the user ID that needs to be run as by all containers</p>
<pre><code>podSecurityContext:
  runAsUser: &lt;a numeric Id&gt;
</code></pre>
<p>Is there a way we can change the user name as well, the way we have for windows pods and container, like below</p>
<pre><code>  securityContext:
    windowsOptions:
      runAsUserName: &quot;ContainerUser&quot;

</code></pre>

Nish
<p>Unfortunately, there is no such way. <code>WindowsSecurityContextOptions</code> contain <strong>Windows-specific</strong> options and credentials. <a href="https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#security-context" rel="nofollow noreferrer">PodSecurityContext</a> allows you to use:</p>
<blockquote>
<ul>
<li><code>securityContext.runAsUser</code> (int64)</li>
</ul>
<p>The UID to run the entrypoint of the container process. Defaults to
user specified in image metadata if unspecified. May also be set in
SecurityContext. If set in both SecurityContext and
PodSecurityContext, the value specified in SecurityContext takes
precedence for that container.</p>
<ul>
<li><code>securityContext.runAsNonRoot</code> (boolean)</li>
</ul>
<p>Indicates that the container must run as a non-root user. If true, the
Kubelet will validate the image at runtime to ensure that it does not
run as UID 0 (root) and fail to start the container if it does. If
unset or false, no such validation will be performed. May also be set
in SecurityContext. If set in both SecurityContext and
PodSecurityContext, the value specified in SecurityContext takes
precedence.</p>
<ul>
<li><code>securityContext.runAsGroup</code> (int64)</li>
</ul>
<p>The GID to run the entrypoint of the container process. Uses runtime
default if unset. May also be set in SecurityContext. If set in both
SecurityContext and PodSecurityContext, the value specified in
SecurityContext takes precedence for that container.</p>
</blockquote>
<p>Trying to use String instead of Integer for <code>runAsUser</code> will result in error:</p>
<pre><code>invalid type for io.k8s.api.core.v1.SecurityContext.runAsUser: got &quot;string&quot;, expected &quot;integer&quot;
</code></pre>
