gpt4 book ai didi

kubernetes - 访问 kubernetes ui 时未找到服务 "kubernetes-dashboard"

转载 作者:行者123 更新时间:2023-12-02 11:30:58 32 4
gpt4 key购买 nike

我正在使用以下命令部署 kubernetes UI:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml

启动代理:
kubectl proxy --address='172.19.104.231' --port=8001 --accept-hosts='^*$'

访问用户界面:
curl http://172.19.104.231:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
http://kubernetes.example.com/api/v1/namespaces/kube-system/services/kube-ui/#/dashboard/

日志输出:
[root@iZuf63refzweg1d9dh94t8Z ~]# curl http://172.19.104.231:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {

},
"status": "Failure",
"message": "services \"kubernetes-dashboard\" not found",
"reason": "NotFound",
"details": {
"name": "kubernetes-dashboard",
"kind": "services"
},
"code": 404}

如何解决问题?检查 Pod 状态:
[root@iZuf63refzweg1d9dh94t8Z ~]# kubectl get pod --namespace=kube-system
NAME READY STATUS RESTARTS AGE
kubernetes-dashboard-7d75c474bb-b2lwd 0/1 Pending 0 34h

最佳答案

如果您使用 K8S 仪表板 v2.0.0-betax,

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta8/aio/deploy/recommended.yaml

然后使用它来访问仪表板:
http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/

如果您使用 K8S 仪表板 v1.10.1,
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml

然后使用它来访问仪表板:
http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/

我也遇到了同样的问题,但后来我意识到仪表板 v2.0.0-betax 和 v1.10.1 使用不同的命名空间。最新版本使用 kubernetes-dashboard 命名空间,但旧版本使用 kube-system 命名空间

关于kubernetes - 访问 kubernetes ui 时未找到服务 "kubernetes-dashboard",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57719573/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com