我使用Treafik入口将请求转发到kubernetes(v1.15.2)仪表板容器中,但它没有给我任何页面查找错误。现在,我想登录到kubernetes仪表板,尝试使用以下命令获取主页html:
curl -L http://127.0.0.1:8443现在,我被困在登录到kubernetes仪表板容器。我使用这个命令登录kubernetes仪表板:
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这就是我已经尝试过的:
[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仪表板容器?
发布于 2020-01-30 11:08:47
推荐的方法是使用kubectl proxy,因为它是独立的,如果有任何入口或其他网络资源,只要kubectl有正确的上下文,available...it就应该在任何环境中工作。
所以试试
kubectl proxy然后使用您的浏览器导航到
http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
请注意,该URL包含kubernetes-dashboard必须部署在其中的名称空间kube-system。如果URL以不同的方式部署在集群上,则相应地更改它。
https://stackoverflow.com/questions/59984490
复制相似问题