首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在终端中登录kubenetes仪表板吊舱

如何在终端中登录kubenetes仪表板吊舱
EN

Stack Overflow用户
提问于 2020-01-30 11:01:16
回答 1查看 1.6K关注 0票数 0

我使用Treafik入口将请求转发到kubernetes(v1.15.2)仪表板容器中,但它没有给我任何页面查找错误。现在,我想登录到kubernetes仪表板,尝试使用以下命令获取主页html:

代码语言:javascript
复制
curl -L http://127.0.0.1:8443

现在,我被困在登录到kubernetes仪表板容器。我使用这个命令登录kubernetes仪表板:

代码语言:javascript
复制
kubectl exec -it kubernetes-dashboard-6466b68b-mrrs9 -- /bin/bash

并抛出此错误:

代码语言:javascript
复制
OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory": unknown

这就是我已经尝试过的:

代码语言:javascript
复制
[root@ops001 conf.d]# docker exec -it kubernetes-dashboard-6466b68b-mrrs9 /bin/ash
Error: No such container: kubernetes-dashboard-6466b68b-mrrs9
[root@ops001 conf.d]# kubectl exec -it kubernetes-dashboard-6466b68b-mrrs9 /bin/bash
Error from server (NotFound): pods "kubernetes-dashboard-6466b68b-mrrs9" not found
[root@ops001 conf.d]# kubectl config set-context --current --namespace=kube-system
Context "kubernetes" modified.
[root@ops001 conf.d]# kubectl exec -it kubernetes-dashboard-6466b68b-mrrs9 /bin/bash
OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory": unknown
command terminated with exit code 126
[root@ops001 conf.d]# kubectl exec -it kubernetes-dashboard-6466b68b-mrrs9 /bin/ash
OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: \"/bin/ash\": stat /bin/ash: no such file or directory": unknown
command terminated with exit code 126
[root@ops001 conf.d]# kubectl exec -it kubernetes-dashboard-6466b68b-mrrs9 -- /bin/bash
OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory": unknown
command terminated with exit code 126
[root@ops001 conf.d]# kubectl exec -it kubernetes-dashboard-6466b68b-mrrs9 --
error: you must specify at least one command for the container
[root@ops001 conf.d]# kubectl exec -it kubernetes-dashboard-6466b68b-mrrs9 -- ls
OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: \"ls\": executable file not found in $PATH": unknown
command terminated with exit code 126
[root@ops001 conf.d]# kubectl exec -it kubernetes-dashboard-6466b68b-mrrs9 -- /bin/ls
OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: \"/bin/ls\": stat /bin/ls: no such file or directory": unknown
command terminated with exit code 126
[root@ops001 conf.d]# kubectl exec -it kubernetes-dashboard-6466b68b-mrrs9 -- /bin/
OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: \"/bin/\": stat /bin/: no such file or directory": unknown
command terminated with exit code 126
[root@ops001 conf.d]# kubectl exec -it kubernetes-dashboard-6466b68b-mrrs9 -- /
OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: \"/\": permission denied": unknown
command terminated with exit code 126
[root@ops001 conf.d]# kubectl exec -it kubernetes-dashboard-6466b68b-mrrs9 -- /bin/sh
OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: \"/bin/sh\": stat /bin/sh: no such file or directory": unknown
command terminated with exit code 126
[root@ops001 conf.d]# kubectl exec -it kubernetes-dashboard-6466b68b-mrrs9 -- /bin/ash
OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: \"/bin/ash\": stat /bin/ash: no such file or directory": unknown
command terminated with exit code 126
[root@ops001 conf.d]# kubectl exec -it kubernetes-dashboard-6466b68b-mrrs9 -- /bin/bash
OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory": unknown
command terminated with exit code 126
[root@ops001 conf.d]# kubectl exec -it kubernetes-dashboard-6466b68b-mrrs9 -- env
OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: \"env\": executable file not found in $PATH": unknown
command terminated with exit code 126
[root@ops001 conf.d]#

我应该如何登录kubenetes仪表板容器?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-01-30 11:08:47

推荐的方法是使用kubectl proxy,因为它是独立的,如果有任何入口或其他网络资源,只要kubectl有正确的上下文,available...it就应该在任何环境中工作。

所以试试

代码语言:javascript
复制
kubectl proxy

然后使用您的浏览器导航到

http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/

请注意,该URL包含kubernetes-dashboard必须部署在其中的名称空间kube-system。如果URL以不同的方式部署在集群上,则相应地更改它。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59984490

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档