k3s-io/k3s · error
can't find ip for interface %s
Error message
can't find ip for interface %s
What it means
Fallback error when the interface is found and up but has no global unicast IPv4 and no global unicast IPv6 address: none of the branches that return an address matched, so there is nothing to return. Loopback and link-local addresses (169.254.x.x, fe80::) are deliberately excluded.
Source
Thrown at pkg/util/net.go:312
continue
}
if ip.IsGlobalUnicast() {
globalUnicasts = append(globalUnicasts, ip.String())
}
}
if len(globalUnicasts) > 1 {
return "", fmt.Errorf("multiple global unicast addresses defined for %s, please set ip from one of %v", ifaceName, globalUnicasts)
}
if len(globalUnicasts) == 1 && len(globalUnicastsIPv6) == 0 {
return globalUnicasts[0], nil
} else if len(globalUnicastsIPv6) > 0 && len(globalUnicasts) == 1 {
return globalUnicasts[0] + "," + globalUnicastsIPv6[0], nil
} else if len(globalUnicastsIPv6) > 0 {
return globalUnicastsIPv6[0], nil
}
return "", fmt.Errorf("can't find ip for interface %s", ifaceName)
}
type multiListener struct {
listeners []net.Listener
closing chan struct{}
conns chan acceptRes
}
type acceptRes struct {
conn net.Conn
err error
}
// explicit interface check
var _ net.Listener = &multiListener{}
var loopbacks = []string{"127.0.0.1", "::1"}
View on GitHub (pinned to 6ba341e396)
Solutions
- Check what is assigned: ip addr show <iface> - is there a non-169.254/non-fe80 address?
- Fix address acquisition (DHCP client running, static config applied, VLAN correct) and restart the service
- If the address arrives late, delay the component until the network is online (network-online.target, readiness checks)
- Alternatively set the node IP explicitly via config instead of deriving it from this interface
Defensive patterns
Strategy: validation
Validate before calling
func waitForGlobalUnicast(name string, timeout time.Duration) error {
deadline := time.Now().Add(timeout)
for time.Now().Before(deadline) {
iface, err := net.InterfaceByName(name)
if err == nil && iface.Flags&net.FlagUp != 0 {
addrs, _ := iface.Addrs()
for _, a := range addrs {
if ip, _, err := net.ParseCIDR(a.String()); err == nil && ip.IsGlobalUnicast() {
return nil
}
}
}
time.Sleep(time.Second)
}
return fmt.Errorf("interface %s never got a global unicast address", name)
} Try / catch
ip, err := util.GetIPFromInterface(name)
if err != nil && strings.Contains(err.Error(), "can't find ip for interface") {
// DHCP/addressing may still be converging: surface which interface and check
// `ip addr show <iface>` for link-local-only state before retrying
}
if err != nil {
return "", err
} Prevention
- Ensure DHCP is reliable (or use static IPs) on the interface the node derives its IP from
- Delay startup until the network is online instead of racing address assignment
- Treat 169.254.x.x on the interface as a DHCP failure signal
- Set node-ip explicitly when the preferred interface has no simple unicast address
When it happens
Trigger: The interface is up but only carries link-local or loopback addresses: DHCP failed or has not run yet, the static IP was not applied yet, or the interface only got an APIPA 169.254.x.x address.
Common situations: VMs booting before DHCP completes; interfaces configured after the service starts; agent containers that see the interface before the host assigns its address; misrouted VLANs where DHCP never answers.
Related errors
- interface %s does not have a correct global unicast ip: %w
- the interface %s is not up
- unable to parse CIDR for interface %s: %w
- multiple global unicast addresses defined for %s, please set
- failed to determine MTU for %s interface
AI-assisted analysis of k3s-io/k3s@6ba341e396 (2026-08-15).
Data as JSON: /api/errors/67f8fe05cc4bb7bd.
Report an issue: GitHub.