具有root访问权限的Kubernetes Pod上的Exec命令 [英] Exec commands on kubernetes pods with root access
本文介绍了具有root访问权限的Kubernetes Pod上的Exec命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个名为"jenkins-app-2843651954-4zqdp"的吊舱.我想在此Pod上临时安装一些软件.我该怎么办?
I have one pod running with name 'jenkins-app-2843651954-4zqdp'. I want to install few softwares temporarily on this pod. How can I do this?
我正在尝试-kubectl exec -it jenkins-app-2843651954-4zqdp -- /bin/bash
然后运行apt-get install命令,但是由于我所访问的用户没有sudo访问权限,所以我无法运行命令
I am trying this- kubectl exec -it jenkins-app-2843651954-4zqdp -- /bin/bash
and then running apt-get install commands but since the user I am accessing with doesn't have sudo access I am not able to run commands
推荐答案
- 使用
kubectl describe pod ...
查找运行Pod的节点和容器ID(docker://...
) - SSH进入节点
- 运行
docker exec -u root ID -- /bin/bash
- Use
kubectl describe pod ...
to find the node running your Pod and the container ID (docker://...
) - SSH into the node
- run
docker exec -u root ID -- /bin/bash
这篇关于具有root访问权限的Kubernetes Pod上的Exec命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文