problem
I have a pod named jenkins-app-2843651954-4zqdp, I want to install several software on this pod, how can I do this? I tried to use kubectl exec -it jenkins-app-2843651954-4zqdp /bin/bash
and then run the apt install
command, but because the user does not have sudo permissions, I cannot run the command.
solve
See what shell the pod uses
# kubectl exec -it jenkins-app-2843651954-4zqdp (bash || ash || sh)
# ps aux
Use kubectl describe pod to find the node and container ID of the running Pod, SSH into the node, and run the following command.
# docker ps | grep xxx
# docker exec -u root ContainerID ash