目 录CONTENT

文章目录

k8s安装kubernetes-dashboard 一直报错 dial tcp 10.96.0.1:443: i/o timeout

Seven
2022-01-11 / 0 评论 / 4 点赞 / 3856 阅读 / 4317 字 / 正在检测是否收录...
ubectl logs kubernetes-dashboard-74d688b6bc-6fjnj -n kubernetes-dashboard
2020/09/03 09:27:34 Starting overwatch
2020/09/03 09:27:34 Using namespace: kubernetes-dashboard
2020/09/03 09:27:34 Using in-cluster config to connect to apiserver
2020/09/03 09:27:34 Using secret token for csrf signing
2020/09/03 09:27:34 Initializing csrf token from kubernetes-dashboard-csrf secret
panic: Get https://10.96.0.1:443/api/v1/namespaces/kubernetes-dashboard/secrets/kubernetes-dashboard-csrf: dial tcp 10.96.0.1:443: i/o timeout

goroutine 1 [running]:
github.com/kubernetes/dashboard/src/app/backend/client/csrf.(*csrfTokenManager).init(0xc00000d7a0)
    /home/travis/build/kubernetes/dashboard/src/app/backend/client/csrf/manager.go:41 +0x446
github.com/kubernetes/dashboard/src/app/backend/client/csrf.NewCsrfTokenManager(...)
    /home/travis/build/kubernetes/dashboard/src/app/backend/client/csrf/manager.go:66
github.com/kubernetes/dashboard/src/app/backend/client.(*clientManager).initCSRFKey(0xc000486680)
    /home/travis/build/kubernetes/dashboard/src/app/backend/client/manager.go:501 +0xc6
github.com/kubernetes/dashboard/src/app/backend/client.(*clientManager).init(0xc000486680)
    /home/travis/build/kubernetes/dashboard/src/app/backend/client/manager.go:469 +0x47
github.com/kubernetes/dashboard/src/app/backend/client.NewClientManager(...)
    /home/travis/build/kubernetes/dashboard/src/app/backend/client/manager.go:550
main.main()
    /home/travis/build/kubernetes/dashboard/src/app/backend/dashboard.go:105 +0x20d

解决方案:

1.关闭iptables/firewalld防火墙 (如果是防火墙原因导致的master节点无法ping通node之上的Pod节点)

systemctl stop iptables/firewalld
 
systemctl disable iptables/firewalld

即使关闭了防火墙跨主机间容器、pod始终无法ping通

这是由于linux还有底层的iptables,所以在node上分别执行:

iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -F
iptables -L -n

问题完美解决

如果从主节点ping Node节点Pod ip地址可以ping通,则查看web ui应该没有问题了。

[root@CentOS kubernetes]# ping 172.16.59.2
PING 172.16.59.2 (172.16.59.2) 56(84) bytes of data.
64 bytes from 172.16.59.2: icmp_seq=1 ttl=63 time=0.568 ms
64 bytes from 172.16.59.2: icmp_seq=2 ttl=63 time=0.486 ms
64 bytes from 172.16.59.2: icmp_seq=3 ttl=63 time=0.460 ms
64 bytes from 172.16.59.2: icmp_seq=4 ttl=63 time=0.485 ms

2.由于关闭或者重启docker而导致的网络未更新问题引起。
Master节点启动 注意先启动kubernetes,再启动docker(如果是关闭docker或者重启docker导致的网络问题,重启master和node节点,注意重启顺序)

主Master节点重启顺序


systemctl enable docker

systemctl enable etcd kube-apiserver kube-scheduler kube-controller-manager

systemctl restart etcd kube-apiserver kube-scheduler kube-controller-manager

systemctl restart flanneld docker

#网络相关后启动 flanneld和docker 重置网络

Node从节点重启顺序

systemctl restart kubelet kube-proxy

systemctl restart flanneld docker

#网络相关后启动 flanneld 和 docker 重置网络

systemctl enable flanneld kubelet kube-proxy docker

3.如果还不行,重新删除安装一下dashboard即可

kubectl delete -f recommended.yaml
kubectl apply -f recommended.yaml

yaml文件名请使用你自己创建pod的文件名。

一般通过上述三种方法即可解决。

4

评论区