plugins icon indicating copy to clipboard operation
plugins copied to clipboard

bridge hangs when configuring coredns POD IP address

Open tanxiaoning007 opened this issue 6 years ago • 2 comments

When I used kubeadm to setup the environment on an new system, and then apply the flannel.yaml, I find that the bridge hangs at Time.Sleep(). Although we can delete CoreDNS Pod multiple times to ensure that the pod works properly, But it is not automatic.


bridge ipam.ExecAdd result IP4:{IP:{IP:10.244.0.2 Mask:ffffff00}
Gateway:10.244.0.1 Routes:[{Dst:{IP:10.244.0.0 Mask:ffff0000} GW:<nil>}]},
DNS:{Nameservers:[] Domain: Search:[] Options:[]}

bridge ipadm.ConfigureIface result Interfaces:[{Name:cni0 Mac:4e:19:41:e9:b4:a7
Sandbox:} {Name:veth5c51018d Mac:6a:a4:9d:71:05:96 Sandbox:} {Name:eth0 Mac:
Sandbox:/proc/15863/ns/net}], IP:[{Version:4 Interface:0xc42000f2c0
Address:{IP:10.244.0.2 Mask:ffffff00} Gateway:10.244.0.1}],
Routes:[{Dst:{IP:10.244.0.0 Mask:ffff0000} GW:10.244.0.1} {Dst:{IP:0.0.0.0
Mask:00000000000000000000ffff00000000} GW:10.244.0.1}], DNS:{Nameservers:[]
Domain: Search:[] Options:[]}


kubectl exec -it coredns-78fcdf6894-8dctr -n kube-system -- /bin/sh
/ # route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.244.0.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0
/ #
pkg/ip/addr_linux.go
	for {
		addrs, err := netlink.AddrList(link, netlink.FAMILY_ALL)
		if err != nil {
			return fmt.Errorf("could not list addresses: %v", err)
		}

		if len(addrs) == 0 {
			return nil
		}

		ok := true
		for _, addr := range addrs {
			if addr.Flags&(syscall.IFA_F_TENTATIVE|syscall.IFA_F_DADFAILED) > 0 {
				ok = false
				break // Break out of the `range addrs`, not the `for`
			}
		}

		if ok {
			return nil
		}
		if time.Now().After(deadline) {
			return fmt.Errorf("link %s still has tentative addresses after %d seconds",
				ifName,
				timeout)
		}

		time.Sleep(SETTLE_INTERVAL) /* <<< blocked */
	}

tanxiaoning007 avatar May 22 '20 09:05 tanxiaoning007

It seems like you're running an old version of the plugins; we don't settle addresses anymore if ipv6 isn't in use.

squeed avatar May 27 '20 15:05 squeed

Can you confirm how long you see it hung for? The loop should exit at deadline which is set ten seconds after starting.

bboreham avatar May 27 '20 15:05 bboreham