Kubernetes UI 无法访问

Kubernetes UI unreachable

我遵循了 this guide on configuring Kubernetes on Fedora master-node, everything goes ok, but when I go for UI, I had nothing and couldn't install as described in this 指南,所以我创建了

{
  "kind": "Namespace",
  "apiVersion": "v1",
  "metadata": {
    "name": "kube-system"
  }
}

并安装为

 kubectl create -f https://rawgit.com/kubernetes/dashboard/master/src/deploy/kubernetes-dashboard.yaml --namespace=kube-system

安装很好,但现在我去

https://<my-ip>:8080/ui

我明白了

{
  "paths": [
    "/api",
    "/api/v1",
    "/apis",
    "/apis/autoscaling",
    "/apis/autoscaling/v1",
    "/apis/batch",
    "/apis/batch/v1",
    "/apis/extensions",
    "/apis/extensions/v1beta1",
    "/healthz",
    "/healthz/ping",
    "/logs/",
    "/metrics",
    "/resetMetrics",
    "/swaggerapi/",
    "/version"
  ]
}

并尝试使用

http://<my-ip>:8080/api/v1/proxy/namespaces/kube-system/services/kubernetes-dashboard

用于访问和获取

{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {},
  "status": "Failure",
  "message": "no endpoints available for service \"kubernetes-dashboard\"",
  "reason": "ServiceUnavailable",
  "code": 503
}

并且不知道如何修复它。有什么建议么?

更新 1 确认插件已安装

root@fed-master ~]# kubectl get deployment kubernetes-dashboard --namespace=kube-system
NAME                   DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
kubernetes-dashboard   1         0         0            0           2h
[root@fed-master ~]# kubectl get svc kubernetes-dashboard --namespace=kube-system
NAME                   CLUSTER-IP       EXTERNAL-IP   PORT(S)   AGE
kubernetes-dashboard   10.254.154.193   nodes         80/TCP    2h

更新 2

kubectl --namespace=kube-system get ep kubernetes-dashboard

给予

NAME                   ENDPOINTS   AGE
kubernetes-dashboard   <none>      4h

那么问题来了,如何自己设置端点?

我是 Kubernetes 的新手,但我只是在本地 VM 集群中为我工作了仪表板,所以我将分享我最近的经验,以防它有帮助。

我像你一样安装了它,使用

kubectl create -f https://rawgit.com/kubernetes/dashboard/master/src/deploy/kubernetes-dashboard.yaml

这给了我这个输出:

deployment "kubernetes-dashboard" created
You have exposed your service on an external port on all nodes in your
cluster.  If you want to expose this service to the external internet, you may
need to set up firewall rules for the service port(s) (tcp:32548) to serve traffic.

See http://releases.k8s.io/release-1.2/docs/user-guide/services-firewalls.md for more details.
service "kubernetes-dashboard" created

所以我使用 master 的 IP 地址通过浏览器访问它,输出中指定的端口,如:

http://<kube-master-IP>:<port>

就我而言,它是:

http://172.17.4.101:32548

但是我是在我的机器上完成的,所以,正如上面的输出中所述,请注意:

If you want to expose this service to the external internet, you may need to set up firewall rules for the service port(s) (tcp:32548) to serve traffic.

同样的事情发生在我身上。有趣的是,它实际上是 运行 在端口 4194 中。我执行了 netstat -planet|grep LISTEN 并尝试了所有端口监听。当我到达 4194 时,我得到了仪表板。所以一切正常。您只需正确配置它以路由到您想要的端口。