我在 vagrant (1.14.0) 中有一个 Kubernetes 集群并安装了 calico。

我已经安装了 kubernetes 仪表板。当我使用 kubectl proxy 访问仪表板时:

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

这是我的 Pod(仪表板经常重新启动):
$ kubectl get pods -n kube-system
NAME                                       READY   STATUS    RESTARTS   AGE
calico-etcd-cj928                          1/1     Running   0          11m
calico-node-4fnb6                          1/1     Running   0          18m
calico-node-qjv7t                          1/1     Running   0          20m
calico-policy-controller-b9b6749c6-29c44   1/1     Running   1          11m
coredns-fb8b8dccf-jjbhk                    1/1     Running   0          20m
coredns-fb8b8dccf-jrc2l                    1/1     Running   0          20m
etcd-k8s-master                            1/1     Running   0          19m
kube-apiserver-k8s-master                  1/1     Running   0          19m
kube-controller-manager-k8s-master         1/1     Running   0          19m
kube-proxy-8mrrr                           1/1     Running   0          18m
kube-proxy-cdsr9                           1/1     Running   0          20m
kube-scheduler-k8s-master                  1/1     Running   0          19m
kubernetes-dashboard-5f7b999d65-nnztw      1/1     Running   3          2m11s

dasbhoard pod 的日志:
2019/03/30 14:36:21 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 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

我可以从主节点和节点 telnet 到 10.96.0.1:443。

什么配置错误?集群的其余部分似乎工作正常,尽管我在 kubelet 中看到了这个日志:
failed to load Kubelet config file /var/lib/kubelet/config.yaml, error failed to read kubelet config file "/var/lib/kubelet/config.yaml"

kubelet 似乎在 master 上运行良好。
集群是使用以下命令创建的:
kubeadm init --apiserver-advertise-address="192.168.50.10" --apiserver-cert-extra-sans="192.168.50.10" --node-name k8s-master --pod-network-cidr=192.168.0.0/16

最佳答案

你应该在/etc/hosts 中定义你的主机名

#hostname
YOUR_HOSTNAME
#nano /etc/hosts
YOUR_IP HOSTNAME

如果你在你的主人中设置了你的主机名但它不起作用试试
# systemctl stop kubelet
# systemctl stop docker
# iptables --flush
# iptables -tnat --flush
# systemctl start kubelet
# systemctl start docker

并且您应该在加入工作节点 之前安装仪表板

禁用防火墙

你可以检查你的空闲内存。

关于Kubernetes 仪表板 : Get https://10. 96.0.1 :443/version: dial tcp 10. 96.0.1:443:I/O 超时,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/55432539/

10-16 02:13