0

我已经在我的 ubuntu 机器上安装并配置了 Kubernetes,遵循了这个文档

部署 Kubernetes-dashboard 后,容器不断崩溃

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

吊舱状态:

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/'

任何人都可以帮助我解决这个问题。

4

1 回答 1

1

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

您看到的是配置错误的结果。乍一看,您似乎混合了 pod、服务和主机网络。

确保您了解 Host 网络、Pod 网络和 Service 网络之间的区别。这三个网络不能重叠。例如,不得--pod-network-cidr=192.168.0.0/16包含您主机的 IP 地址,如有必要,请将其更改为或更小。10.0.0.0/16

清楚地了解网络拓扑后,再次运行设置,一切都会正确配置,包括 Kubernetes CA。

于 2018-09-12T06:50:46.297 回答