<p>Is there a flag/field in kubectl describe pods which tells if the container is running as root or non-root, I have few containers, I need to check if they are running as root</p>

Sandeep540
<p>You can check the user and group ID of the container running in a Pod by running the command <code>kubectl exec -it &lt;pod-name&gt; -- ps aux</code>. The first column of the output will show the user and group ID in the format <code>&lt;user&gt;/&lt;group&gt;</code>. If the user ID is 0, then the container is running as the root user. If the user ID is not 0, then the container is running as a non-root user.</p>
<p>You can also check the security context of a pod using the command <code>kubectl describe pod &lt;pod-name&gt;</code>. The output will include a section labeled &quot;Security Context&quot; which will indicate the user and group ID the pod is running as.</p>
<p>You can also use <code>kubectl get pod &lt;pod-name&gt; -o</code> jsonpath='{.spec.containers[*].securityContext.runAsUser}' to check the user ID of the pod.</p>
