containernetworking / plugins

Some reference and example networking plugins, maintained by the CNI team.
Apache License 2.0
2.23k stars 788 forks source link

plugin type="bridge" name="kubernetes" failed (add): failed to make veth pair: invalid argument #877

Closed mgrzybowski closed 1 year ago

mgrzybowski commented 1 year ago

Hi I'm trying to setup kubernetes node on routed host. By routed host i mean that each interface on the host is addressed by ipv6 link local and BGP session is established (on each interface) to give access do ipv4 networks:

# ip r
default nhid 98 proto bgp metric 20 
    nexthop via inet6 fe80::1eea:bff:fee0:c301 dev eth0.205 weight 1 
    nexthop via inet6 fe80::1eea:bff:fee0:9f01 dev eth1.205 weight 1 
    nexthop via inet6 fe80::1eea:bff:fee0:c301 dev eth2.205 weight 1 
    nexthop via inet6 fe80::1eea:bff:fee0:9f01 dev eth3.205 weight 1 
169.254.111.0/24 dev docker0 proto kernel scope link src 169.254.111.1 

kube-bridge was created:

# brctl  show
bridge name bridge id       STP enabled interfaces
docker0     8000.0242512f4e9c   no      vethc96ffb0
kube-bridge     8000.665490851315   no      

but cnitool returns errors when creating interfaces

# CNI_PATH=/opt/cni/bin/ /root/go/bin/cnitool  add mynet /var/run/netns/testing
plugin type="bridge" name="kubernetes" failed (add): failed to make veth pair: invalid argument

bridge plugin got this as stdin config:

{"bridge":"kube-bridge","cniVersion":"0.3.0","ipam":{"subnet":"172.18.1.0/24","type":"host-local"},"isDefaultGateway":true,"mtu":65536,"name":"mynet","type":"bridge"}

and those env vaiables:

            "env": {
                "CNI_COMMAND":"ADD",
                "CNI_CONTAINERID":"cnitool-77383ca0a0715733ca6f",
                "CNI_NETNS":"/var/run/netns/testing",
                "CNI_ARGS":"",
                "CNI_IFNAME":"eth0",
                "CNI_PATH":"/root/workspace/plugins/bin/"
           }

It seems that netlink messages for interface pair creation were rejected .

mgrzybowski commented 1 year ago
"mtu":65536

Caused this issue. Host IP is on "lo" interface. Somehow plugin config deployed got "lo" MTU . bridge pugin works as expected when MTU is forced to 1500 .