Events: Type Reason Age From Message Normal Scheduled 53m default-scheduler Successfully assigned xxx/xxx1-64784c458b-q67tx to node001 Warning FailedCreatePodSandBox 53m kubelet, node001 Failed to create pod sandbox: rpc er or: code = Unknown desc = failed to set up sandbox container "xxx" network for pod "xxxl-64784c458b-q67tx": NetworkPlugin cni failed to set up pod "xxx1-64784c458b-q67tx_xxx" network: Multus: Err adding pod to network "net-netl-nodeOOl": Multus: error in invoke Delegate add - "macvlan": failed to create macvlan: device or resource busy Warning FailedCreatePodSandBox 53m kubelet, node001 Failed to create pod sandbox: rpc er or: code = Unknown desc = failed to set up sandbox container "xxx" network for pod "xxxl-64784c458b-q67tx": NetworkPlugin cni failed to set up pod "xxx1-64784c458b-q67tx_xxx" network: Multus: Err adding pod to network "net-netl-nodeOOl": Multus: error in invoke Delegate add - "macvlan": failed to create macvlan: device or resource busy ...
分析过程
从日志初步看,创建Pod的sandbox异常,具体是Multus无法将Pod添加到net-netl-nodeOOl网络命名空间内,再具体点是Multus无法创建macvlan网络,原因是device or resource busy;
plugins/main/macvlan/macvlan.go:169 if err := netlink.LinkAdd(mv); err != nil { returnnil, fmt.Errorf("failed to create macvlan: %v", err) }
// LinkAdd adds a new link device. The type and features of the device // are taken from the parameters in the link object. // Equivalent to: `ip link add $link` funcLinkAdd(link Link)error { return pkgHandle.LinkAdd(link) }
// LinkAdd adds a new link device. The type and features of the device // are taken from the parameters in the link object. // Equivalent to: `ip link add $link` func(h *Handle) LinkAdd(link Link) error { return h.linkModify(link, unix.NLM_F_CREATE|unix.NLM_F_EXCL|unix.NLM_F_ACK) } ...
根据上述代码和注释简单的看,是在执行ip link add $link命令时报错,实际验证看看:
1 2
[root@node001 ~] ip link add link bond1 name macvlan1 type macvlan mode bridge RTNETLINK answers: Device or resource busy
确实如此,在bond1接口上无法配置macvlan,那换一个接口试试:
1 2 3 4 5 6
[root@node001 ~] ip link add link bond0 name macvlan1 type macvlan mode bridge [root@node001 ~] ip link show ... 110: macvlan1@bond0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000 link/ether ea:31:c9:7f:d9:a4 brd ff:ff:ff:ff:ff:ff ...
配置成功,说明bond1接口有什么问题,看看这俩接口有没有差异:
1 2 3 4 5 6 7 8 9 10 11 12
[root@node001 ~] ip addr show ... 2: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether 0c:da:41:1d:6f:ca brd ff:ff:ff:ff:ff:ff inet x.x.x.x/16 brd x.x.255.255 scope global bond0 valid_lft forever preferred_lft forever inet6 fe80::eda:41ff:fe1d:6fca/64 scope link valid_lft forever preferred_lft forever ... 17: bond1: <BROADCAST,MULTICAST,MASTER,SLAVE,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether 0c:da:41:1d:a8:62 brd ff:ff:ff:ff:ff:ff ...