Currently I enter the pod as a mysql user using the command:
kubectl exec -it PODNAME -n NAMESPACE bash
I want to enter a container as root. I've tried the following command:
kubectl exec -it PODNAME -n NAMESPACE -u root ID /bin/bash
kubectl exec -it PODNAME -n NAMESPACE -u root ID bash
There must be a way. :-)
I found the answer.
You cannot log into the pod directly as root via kubectl.
You can do via the following steps.
find out what node it is running on kubectl get pod -n [NAMESPACE] -o wide
ssh node
find the docker container sudo docker ps | grep [namespace]
log into container as root sudo docker exec -it -u root [DOCKER ID] /bin/bash