<p>Currently I enter the pod as a mysql user using the command:</p>

<p><code>kubectl exec -it PODNAME -n NAMESPACE bash</code></p>

<p>I want to enter a container as root.
I've tried the following command:</p>

<p><code>kubectl exec -it PODNAME -n NAMESPACE -u root ID /bin/bash</code></p>

<p><code>kubectl exec -it PODNAME -n NAMESPACE -u root ID bash</code></p>

<p>There must be a way.
:-)</p>

mac
<p>I found the answer. </p>

<p>You cannot log into the pod directly as root via kubectl. </p>

<p>You can do via the following steps.</p>

<p>1) find out what node it is running on <code>kubectl get po -n [NAMESPACE] -o wide</code></p>

<p>2) ssh node </p>

<p>3) find the docker container <code>sudo docker ps | grep [namespace]</code></p>

<p>4) log into container as root <code>sudo docker exec -it -u root [DOCKER ID] /bin/bash</code></p>
