flannel无法跨主机ping通容器的解决方式
生活随笔
收集整理的這篇文章主要介紹了
flannel无法跨主机ping通容器的解决方式
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?
前幾天,出現了無法跨主機ping通容器的情況,導致一個node機網絡中斷,無法訪問,排查過程如下。
[root@node2 ~]# ping 10.1.19.3 PING 10.1.19.3 (10.1.19.3) 56(84) bytes of data. 64 bytes from 10.1.19.3: icmp_seq=1 ttl=64 time=0.122 ms 64 bytes from 10.1.19.3: icmp_seq=2 ttl=64 time=0.073 ms
可以ping通,進行下一步
[root@node1 ~]# ping 10.1.19.3 PING 10.1.19.3 (10.1.19.3) 56(84) bytes of data. ^C --- 10.1.19.3 ping statistics --- 14 packets transmitted, 0 received, 100% packet loss, time 12999ms
無法ping通,檢查代理機
[root@node1 ~]# etcdctl ls /coreos.com/network/subnets /coreos.com/network/subnets/10.1.91.0-24 /coreos.com/network/subnets/10.1.93.0-24 /coreos.com/network/subnets/10.1.94.0-24 /coreos.com/network/subnets/10.1.19.0-24 /coreos.com/network/subnets/10.1.77.0-24
網段配置是正常的,已經含有10.1.19.0-24 段了
[root@node2 ~]# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.19.51 0.0.0.0 UG 100 0 0 eth0 10.1.19.0 0.0.0.0 255.255.255.0 U 0 0 0 docker0 192.168.19.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
配置不完整,缺少flannel路由配置
[root@node2 ~]# route add -net 10.1.0.0 netmask 255.255.0.0 dev flannel0 [root@node2 ~]# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.19.51 0.0.0.0 UG 100 0 0 eth0 10.1.0.0 0.0.0.0 255.255.0.0 U 0 0 0 flannel0 10.1.19.0 0.0.0.0 255.255.255.0 U 0 0 0 docker0 192.168.19.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
創建完成之后沒確認網絡是否通了
包不會被iptables的forward規則攔截
sudo iptables -P FORWARD ACCEPT[root@node1 ~]# ping 10.1.19.3 PING 10.1.19.3 (10.1.19.3) 56(84) bytes of data. 64 bytes from 10.1.19.3: icmp_seq=1 ttl=61 time=0.444 ms 64 bytes from 10.1.19.3: icmp_seq=2 ttl=61 time=0.288 ms ^C --- 10.1.19.3 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 999ms rtt min/avg/max/mdev = 0.288/0.366/0.444/0.078 ms
網絡沒有問題了
以上
轉載于:https://www.cnblogs.com/cxbhakim/p/9626507.html
總結
以上是生活随笔為你收集整理的flannel无法跨主机ping通容器的解决方式的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: QMap与QHash
- 下一篇: QT的mouseMoveEvent事件失