在具有 root 访问权限的 kubernetes pod 上执行命令 [英] Exec commands on kubernetes pods with root access
本文介绍了在具有 root 访问权限的 kubernetes pod 上执行命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个名为jenkins-app-2843651954-4zqdp"的 Pod 正在运行.我想在这个 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 -it -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 -it -u root ID /bin/bash
这篇关于在具有 root 访问权限的 kubernetes pod 上执行命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文