Solve the problem of "In Pod container, without sudo permission, unable to install software and perform specific operations"

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/bashand then run the apt installcommand, 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

Guess you like

Origin blog.csdn.net/yjk13703623757/article/details/108213783