Kubernetes - pod没有从Flannel CIDR获得IP

时间:2016-11-14 15:52:22

标签: kubernetes flannel

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

但是,当pod出现时,该节点上的docker容器从cbr0接口获取IP地址,从flannel接口获取 not 。我确实尝试手动删除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地址来自法兰绒界面?

1 个答案:

答案 0 :(得分:1)

你可能想检查你的kubernetes部署,以确保你没有使用任何网络插件,因为你使用法兰绒。

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