0

我已经在工作节点上成功配置了 Flannel。当我这样做ifconfig时,在工作人员上,我看到了一个flannel.1界面(我正在使用 vxlan)。还有docker0cbr0接口。

但是,当 pod 启动时,该节点上的 docker 容器从cbr0接口获取 IP 地址,而不是从 flannel 接口获取。我确实尝试过手动删除 cbr0 接口,但是当 docker 容器被安排在 pod 出现的节点上时,它会恢复。

Docker 是这样启动的:

dockerd --bip=10.200.50.1/24 --mtu=8951 --iptables=false --ip-masq=false --host=unix:///var/run/docker.sock --log-level=error --storage-driver=overlay

法兰绒环境:

$ cat /run/flannel/subnet.env
FLANNEL_NETWORK=10.200.0.0/16
FLANNEL_SUBNET=10.200.50.1/24
FLANNEL_MTU=8951
FLANNEL_IPMASQ=false

ifconfig说:

$ ifconfig
cbr0      Link encap:Ethernet  HWaddr 0a:58:0a:c8:04:01
          inet addr:10.200.4.1  Bcast:0.0.0.0  Mask:255.255.255.0
          inet6 addr: fe80::d99:edff:fec6:9dd0/64 Scope:Link
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:536 (536.0 B)  TX bytes:648 (648.0 B)

docker0   Link encap:Ethernet  HWaddr 02:42:a4:4b:44:dc
          inet addr:10.200.50.1  Bcast:0.0.0.0  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth0      Link encap:Ethernet  HWaddr 12:e7:81:c3:1e:58
          inet addr:10.0.2.152  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe90::10e8:86ff:fec3:1e58/54 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:9001  Metric:1
          RX packets:911006 errors:0 dropped:0 overruns:0 frame:0
          TX packets:821093 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:725362580 (725.3 MB)  TX bytes:155420170 (155.4 MB)

flannel.1 Link encap:Ethernet  HWaddr 12:10:54:76:3e:c4
          inet addr:10.200.50.0  Bcast:0.0.0.0  Mask:255.255.0.0
          inet6 addr: fe80::1410:54ff:fe86:3ec4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:8951  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:11 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:27 errors:0 dropped:0 overruns:0 frame:0
          TX packets:27 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:1624 (1.6 KB)  TX bytes:1624 (1.6 KB)

如何确保 pod 的 IP 地址来自 flannel 接口?

4

1 回答 1

1

您可能需要检查您的 kubernetes 部署,以确保您没有使用任何网络插件,因为您使用的是 flannel。

http://kubernetes.io/docs/admin/network-plugins/

于 2016-11-16T17:46:22.433 回答