Kubernetes-dashboard pod一次又一次崩溃

时间:2018-09-11 09:39:23

标签: kubernetes kubernetes-dashboard

我已经在ubuntu机器上安装并配置了Kubernetes,并遵循此Document

部署Kubernetes仪表板后,容器继续崩溃

kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml

使用以下命令启动代理:

kubectl proxy --address='0.0.0.0' --accept-hosts='.*' --port=8001

Pod状态:

kubectl get pods -o wide --all-namespaces
....
....
kube-system   kubernetes-dashboard-64576d84bd-z6pff     0/1       CrashLoopBackOff   26         2h        192.168.162.87   kb-node     <none>

Kubernetes系统日志:

root@KB-master:~# kubectl -n kube-system logs kubernetes-dashboard-64576d84bd-z6pff --follow
2018/09/11 09:27:03 Starting overwatch
2018/09/11 09:27:03 Using apiserver-host location: http://192.168.33.30:8001
2018/09/11 09:27:03 Skipping in-cluster config
2018/09/11 09:27:03 Using random key for csrf signing
2018/09/11 09:27:03 No request provided. Skipping authorization
2018/09/11 09:27:33 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://192.168.33.30:8001/version: dial tcp 192.168.33.30:8001: i/o timeout
Refer to our FAQ and wiki pages for more information: https://github.com/kubernetes/dashboard/wiki/FAQ

当我尝试点击浏览器上的链接时获取消息

URL:http://192.168.33.30:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#!/login

Error: 'dial tcp 192.168.162.87:8443: connect: connection refused'
Trying to reach: 'https://192.168.162.87:8443/'

任何人都可以帮助我。

1 个答案:

答案 0 :(得分:1)

http://192.168.33.30:8001不是合法的API服务器URL。与API服务器的所有通信内部都使用TLS(https:// URL方案)。这些通信使用API​​服务器CA证书进行验证,并通过同一CA签名的令牌进行身份验证。

您看到的是配置错误的结果。乍一看,您似乎将Pod,服务和主机网络混合在一起。

确保您了解主机网络,Pod网络和服务网络之间的区别。这3个网络不能重叠。例如,--pod-network-cidr=192.168.0.0/16必须包含主机的IP地址,将其更改为10.0.0.0/16或必要时更小的值。

对网络拓扑有清晰的了解后,再次运行安装程序,包括Kubernetes CA在内的所有内容都将正确配置。