当容器运行之后,节点之间多了个虚拟接口cni0,它是由flanneld创建的一个虚拟网桥叫cni0,供pod本地通信使用.flanneld为每个pod创建一对veth虚拟设备,一端放在容器接口上,一端放在cni0桥上.
[root@k8s-02 tasks]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:0c:29:a5:8b:c2 brd ff:ff:ff:ff:ff:ff
inet 192.168.30.117/24 brd 192.168.30.255 scope global dynamic ens160
valid_lft 85880sec preferred_lft 85880sec
inet6 fe80::20c:29ff:fea5:8bc2/64 scope link
valid_lft forever preferred_lft forever
3: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:0c:29:a5:8b:cc brd ff:ff:ff:ff:ff:ff
inet 192.168.60.117/24 brd 192.168.60.255 scope global ens192
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fea5:8bcc/64 scope link
valid_lft forever preferred_lft forever
4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:58:f2:b8:c6 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever
5: flannel.1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UNKNOWN group default
link/ether 2e:47:68:46:e7:ea brd ff:ff:ff:ff:ff:ff
inet 172.20.1.0/32 scope global flannel.1
valid_lft forever preferred_lft forever
inet6 fe80::2c47:68ff:fe46:e7ea/64 scope link
valid_lft forever preferred_lft forever
6: cni0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UP group default qlen 1000
link/ether 9e:d6:a0:2d:cc:6b brd ff:ff:ff:ff:ff:ff
inet 172.20.1.1/24 scope global cni0
valid_lft forever preferred_lft forever
inet6 fe80::9cd6:a0ff:fe2d:cc6b/64 scope link
valid_lft forever preferred_lft forever
7: vethf253df1c@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue master cni0 state UP group default
link/ether 8e:61:9f:24:ed:c6 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet6 fe80::8c61:9fff:fe24:edc6/64 scope link
valid_lft forever preferred_lft forever
8: vethf894f038@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue master cni0 state UP group default
link/ether 9a:2e:2b:a3:6d:d9 brd ff:ff:ff:ff:ff:ff link-netnsid 1
inet6 fe80::982e:2bff:fea3:6dd9/64 scope link
valid_lft forever preferred_lft forever