查看pod日志
$ sudo kubectl logs kubernetes-dashboard-6dccb458d5-x7xft --namespace=kube-system
2019/03/22 10:16:18 Starting overwatch
2019/03/22 10:16:18 Using apiserver-host location: http://10.136.157.23:8080
2019/03/22 10:16:18 Skipping in-cluster config
2019/03/22 10:16:18 Using random key for csrf signing
2019/03/22 10:16:18 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 account's configuration) or the --apiserver-host param points to a server that does not exist. Reason: Get http://10.136.157.23:8080/version: dial tcp 10.136.157.23:8080: connect: connection refused
Refer to our FAQ and wiki pages for more information: https://github.com/kubernetes/dashboard/wiki/FAQ
从日志上来看,是因为无法连接到 apiserver。
原因是在安装 kubernetes-dashboard 时,解除了 kubernetes-dashboard.yml 文件中 --apiserver 的注释,并且配置了错误的 apiserver 地址,kubernetes-dashboard默认访问 https://localhost:6443。
解决方案
- 注释 --apiserver
- 卸载kubernetes-dashboard
- 重新安装kubernetes-dashboard
网友评论