kernelkit / infix

Linux :yellow_heart: NETCONF = Infix
https://kernelkit.org
GNU General Public License v2.0
52 stars 12 forks source link

Failing to stop container with interface names changed #708

Closed troglobit closed 1 month ago

troglobit commented 1 month ago

One user story for containers with multiple interfaces is to name the interfaces according to what they are connected to, be it br0 or the lan side for a network (for firewall containers).

Image

However, renaming the interfaces from inside the container seems to confuse the CNI host-device plugin when stopping the container, to the point of it not being able to restore the interface at all. Only a reboot helps.

Oct 12 15:02:40 example-05-24-49 klishd[7248]: user "admin" starting interactive sysrepo session.
Oct 12 15:02:43 example-05-24-49 finit[1]: Stopping k8s-logger:system[6153], sending SIGTERM ...
Oct 12 15:02:43 example-05-24-49 k8s-logger: got signal 15
Oct 12 15:02:43 example-05-24-49 system[0]: shutting down.
Oct 12 15:02:43 example-05-24-49 finit[1]: Calling 'container -n system stop' ...
Oct 12 15:02:43 example-05-24-49 finit[1]: Stopped k8s-logger:system[6153]
Oct 12 15:02:43 example-05-24-49 kernel: veth0a: renamed from eth0
Oct 12 15:02:44 example-05-24-49 kernel: br0: port 14(veth0b) entered disabled state
Oct 12 15:02:44 example-05-24-49 kernel: eth0: renamed from veth0a
Oct 12 15:02:44 example-05-24-49 kernel: br0: port 14(veth0b) entered blocking state
Oct 12 15:02:44 example-05-24-49 kernel: br0: port 14(veth0b) entered forwarding state
Oct 12 15:02:44 example-05-24-49 kernel: br1: port 4(veth1b) entered disabled state
Oct 12 15:02:44 example-05-24-49 kernel: veth1a: renamed from eth1
Oct 12 15:02:44 example-05-24-49 kernel: eth1: renamed from veth1a
Oct 12 15:02:44 example-05-24-49 container:system[7334]: ERROR: Unable to clean up network for container 3b341d6: "tearing down network namespace configuration for container 3b341d6: 2 errors occurred:\n\t* plugin type=\"host-device\" failed (delete): cni plugin host-device failed: failed to move \"veth0a\" to host netns: file exists\n\t* plugin type=\"host-device\" failed (delete): cni plugin host-device failed: failed to move \"veth1a\
Oct 12 15:02:44 example-05-24-49 container:system[7334]: " to host netns: file exists\n\n"
Oct 12 15:02:44 example-05-24-49 container:system[7334]: system
Oct 12 15:02:44 example-05-24-49 finit[1]: Stopped container:system[6334]
Oct 12 15:02:44 example-05-24-49 kernel: br1: port 4(veth1b) entered blocking state
Oct 12 15:02:44 example-05-24-49 kernel: br1: port 4(veth1b) entered forwarding state
Oct 12 15:02:44 example-05-24-49 kernel: br1: port 4(veth1b) entered disabled state
Oct 12 15:02:44 example-05-24-49 kernel: br0: port 14(veth0b) entered disabled state
Oct 12 15:02:44 example-05-24-49 kernel: veth1b (unregistering): left allmulticast mode
Oct 12 15:02:44 example-05-24-49 kernel: veth1b (unregistering): left promiscuous mode
Oct 12 15:02:44 example-05-24-49 kernel: br1: port 4(veth1b) entered disabled state
Oct 12 15:02:44 example-05-24-49 kernel: veth0b (unregistering): left allmulticast mode
Oct 12 15:02:44 example-05-24-49 kernel: veth0b (unregistering): left promiscuous mode
Oct 12 15:02:44 example-05-24-49 kernel: br0: port 14(veth0b) entered disabled state
Oct 12 15:02:54 example-05-24-49 finit[1]: Starting k8s-logger:system[7574]
Oct 12 15:02:54 example-05-24-49 system[0]: creating pidfile /run/k8s-logger-system.pid
Oct 12 15:02:54 example-05-24-49 system[0]: opening fifo /run/containers/system.fifo
Oct 12 15:02:54 example-05-24-49 system[0]: entering poll loop ...
Oct 12 15:02:54 example-05-24-49 finit[1]: Calling 'container -n system start' ...
Oct 12 15:02:54 example-05-24-49 container:system[7585]: ^[[33mWARN^[[0m[0000] 1 error occurred:
Oct 12 15:02:54 example-05-24-49 container:system[7585]:    * plugin type="host-device" failed (delete): cni plugin host-device failed: failed to find "eth0": Link not found
Oct 12 15:02:54 example-05-24-49 container:system[7585]:
Oct 12 15:02:54 example-05-24-49 container:system[7585]: Error: unable to start container "3b341d6": plugin type="host-device" failed (add): cni plugin host-device failed: failed to find host device: Link not found
Oct 12 15:02:56 example-05-24-49 finit[1]: Service container:system[0] died, restarting in 2000 msec (1/10)