I have a K8s container running as root
. I am trying to exec into the container with a non-root
user using the K8s Python client. K8s does not support the feature to pass user flag to exec command as of today.
There is a hack to bypass this limitation using kubectl. The idea is to run a docker Pod on the same node as the target Pod. For more details, see this tool . The tool under the hood uses the kubectl run command
. Is there any way to get equivalent to run command using the Python client?
kubernetes plugins are just scripts themselves, so you could in theory do something as simple as:
bash -x ./kube-ssh --option --option...
And watch as it runs the commands
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.