# kubectl get nodes
NAME STATUS ROLES AGE VERSION
sqian-k8s-node1 Ready master,node 4h53m v1.13.0
sqian-k8s-node2 Ready master,node 4h52m v1.13.0
sqian-k8s-node3 Ready master,node 4h52m v1.13.0
# kubectl exec -it kube-flannel-4rrms -n kube-system -- /opt/bin/flanneld -version
Defaulting container name to kube-flannel.
Use 'kubectl describe pod/kube-flannel-4rrms -n kube-system' to see all of the containers in this pod.
v0.10.0
# ip neigh show dev flannel.1172.168.1.0 lladdr 02:74:40:05:9f:87 PERMANENT
172.168.2.0 lladdr 52:91:cb:aa:d1:bd PERMANENT
其中172.168.1.0是node2上flannel.1的地址。
172.168.2.0是node3上flannel.1的地址。
cni0
查看cni0的一些信息:
1
2
3
4
5
# brctl show cni0
bridge name bridge id STP enabled interfaces
cni0 8000.0a58aca80001 no veth0c81e625
veth3752bd50
vethf12090da
可见cni0是一个linux bridge设备,上面挂在了三个容器的网卡对端设备。
查看其ip neigh:
1
2
3
4
# ip neigh show dev cni0172.168.0.5 lladdr 0a:58:ac:a8:00:05 STALE
172.168.0.4 lladdr 0a:58:ac:a8:00:04 REACHABLE
172.168.0.6 lladdr 0a:58:ac:a8:00:06 STALE
上述三个IP就是调度到该节点上的三个pod的IP。
route信息
最后来看一下宿主机上的路由信息
1
2
3
4
5
6
7
8
# ip r
default via 10.212.36.254 dev eth0 ## 默认路由10.212.36.0/24 dev eth0 proto kernel scope link src 10.212.36.168 ## 宿主机网卡的路由169.254.0.0/16 dev eth0 scope link metric 1002172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1
172.168.0.0/24 dev cni0 proto kernel scope link src 172.168.0.1 ## (1)172.168.1.0/24 via 172.168.1.0 dev flannel.1 onlink ## (2)172.168.2.0/24 via 172.168.2.0 dev flannel.1 onlink ## (3)
# kubectl exec -it test-75b789cbdc-vdsg4 ip r
default via 172.168.0.1 dev eth0
172.168.0.0/24 dev eth0 proto kernel scope link src 172.168.0.6
172.168.0.0/16 via 172.168.0.1 dev eth0