我正在使用以下命令部署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}
如何解决该问题?检查广告连播状态:
[root@iZuf63refzweg1d9dh94t8Z ~]# kubectl get pod --namespace=kube-system
NAME READY STATUS RESTARTS AGE
kubernetes-dashboard-7d75c474bb-b2lwd 0/1 Pending 0 34h
答案 0 :(得分:1)
此消息:
"message": "services \"kubernetes-dashboard\" not found"
仅表示该服务不存在。
首先检查您的仪表板(服务和窗格)是否正在使用此命令
kubectl get pods,svc --all-namespaces -o wide
请按照教程Command line proxy
关于广告连播状态的问题,请使用此命令,以便您知道状态为何挂起而不是运行。
kubectl describe pod kubernetes-dashboard-7d75c474bb-b2lwd -n kubernetes-dashboard
答案 1 :(得分:1)
很明显,在整个公开的HTTP Service代理方法中,kube-system
Namespace中不存在的k8 API的错误消息状态,如答案中提到的@ jt97。
作为进一步参考,一旦直接在JSON数据格式的HTTP调用中拥有exposed K8s REST API,您也可以考虑查询K8s库存对象。
例如:
curl http://172.19.104.231:8001/api/v1/namespaces/kube-system/services/
答案 2 :(得分:1)
尝试此端点:
卷曲http://172.19.104.231:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
或这个:
答案 3 :(得分:0)
如果您使用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命名空间