kubeadm 部署的k8s集群(1.11.1) Dashboard遇到的问题

错误日志:

2018/07/28 08:51:12 Starting overwatch
2018/07/28 08:51:12 Using in-cluster config to connect to apiserver
2018/07/28 08:51:12 Using service account token for csrf signing
2018/07/28 08:51:12 No request provided. Skipping authorization
2018/07/28 08:51:42 Error while initializing connection to Kubernetes apiserver. This most likely means that the cluster is misconfigured (e.g., it has invalid apiserver certificates or service accounts configuration) or the --apiserver-host param points to a server that does not exist. Reason: Get https://10.96.0.1:443/version: dial tcp 10.96.0.1:443: i/o timeout
Refer to our FAQ and wiki pages for more information: https://github.com/kubernetes/dashboard/wiki/FAQ

问题原因:
官方的yaml配置文件(https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml)中有这么一段:

#Comment the following tolerations if Dashboard must not be deployed on master
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule

使得pod不会分配到到master节点, 并且kubeadm部署的apiserver中启用的验证方式为Node和RBAC, 且关闭了insecure-port, 我猜测可能是这个原因导致连接不上apiServer, 即使是手动修改也不行--apiserver-host参数也不行

解决方法:
保存https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml文件到本地:
wget https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml

然后注释掉下列选中的内容:


kubeadm 部署的k8s集群(1.11.1) Dashboard遇到的问题_第1张图片
dashboard可部署到master节点

再增加选中的节点(k8s-node1为你的master节点名称):

kubeadm 部署的k8s集群(1.11.1) Dashboard遇到的问题_第2张图片
分配到master节点

最后执行
kubectl delete https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml
删除pod, 再执行kubectl create -f kubernetes-dashboard.yaml即可

你可能感兴趣的:(kubeadm 部署的k8s集群(1.11.1) Dashboard遇到的问题)