Kubernetes - pod is not getting IP from Flannel CIDR

11/14/2016

I've configured Flannel successfully on the worker nodes. When I do ifconfig, on the worker, I see a flannel.1 interface (I'm using vxlan). There are also docker0 and cbr0 interfaces.

However, when the pod comes up, the docker container on that node gets the IP address from the cbr0 interface and not from the flannel interface. I did try manually removing the cbr0 interface, but it comes back up when the docker container gets scheduled on the node where the pod shows up.

Docker is started this way:

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

Flannel env:

$ 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 says:

$ 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)

How do I ensure that the pod's IP address is derived from the flannel interface?

-- jeffreyveon
flannel
kubernetes

1 Answer

11/16/2016

you might want to check your kubernetes deployment to ensure that you are not using any network plugins since you are using flannel.

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

-- djsly
Source: StackOverflow