Skip to content

DHCP client will never restart if unable to get IP address

Describe the bug This is something I've picked up on the kube-vip's Slack. It seems (if I understand the code correctly) that if DHCP is being used and kube-vip is unable (for some reason) to get the IP address from the DHCP server it will only try to do so 3 times in a row (with backing off counter, for a minute) and if it will be unable to get address it will kill the DHCP client and do nothing at all.

To Reproduce Steps to reproduce the behavior:

I am not really sure yet. Maybe start kube-vip within an environment with no DHCP server/DHCP server blocked with firewall?

Expected behavior

  1. DHCP client should still try to get the IP or should kill the kube-vip's pod and emit an error (?)
  2. DHCP configuration (number of attempts, timeout etc.) should be configurable.

Additional context

2025/06/20 11:58:36 INFO creating new macvlan interface for DHCP interface=vip-97a8bd4e
2025/06/20 11:58:36 INFO Generated mac address=00:00:6C:5b:43:b5
2025/06/20 11:58:36 INFO new macvlan interface interface=vip-97a8bd4e "hardware address"="\x00\x00l[C\xb5"
2025/06/20 11:58:50 INFO [UPNP] Refreshing Instances "number of instances"=0
2025/06/20 11:59:11 ERROR request failed err="unable to receive an offer: got an error while the discovery request: no matching response packet received" waiting=10s
2025/06/20 11:59:56 ERROR request failed err="unable to receive an offer: got an error while the discovery request: no matching response packet received" waiting=19.614284255s
2025/06/20 12:00:51 ERROR failed to get an IP address after 3 attempts, error unable to receive an offer: got an error while the discovery request: no matching response packet received, giving up
2025/06/20 12:00:51 ERROR error starting DHCP for kube-system/nginx-dhcp: error: failed to get an IP address after 3 attempts, error unable to receive an offer: got an error while the discovery request: no matching response packet received, giving up
2025/06/20 12:03:50 INFO [UPNP] Refreshing Instances "number of instances"=0
2025/06/20 12:08:50 INFO [UPNP] Refreshing Instances "number of instances"=0

This might be a good first isse for a person who understands a bit of concurrency in Go. Or I can work on this in some spare time.