tinkerbell / k8s-sandbox

The easiest way to setup the Tinkerbell Stack on Kubernetes
Apache License 2.0
9 stars 9 forks source link

dhcrelay drop the dhcp-ack from calixxxx #15

Closed sheepcat closed 1 year ago

sheepcat commented 2 years ago

Hi guys I am here again

i deploy tinkerbell in k8s, my k8s version is V1.22.3, my cni is Calico my boots docker and dhcrelay docker is on same host. when i pxe boot a machine, i can see the dhcp-discover packet arrived into boots and the boots give dhcp-offer

i can tcpdump both the dhcp-discover and dhcp-offer packet in calicxxxx device but i can only tcpdump the dhcp-discover packet in host's nic, such as ens3

pxe-boot ---> host ens3 ---> dhcrelay ---> calixxxx ----> calixxxx ---> boots

boots ---> calixxxx ----> calixxxx -----> the packet is not arrived ens3

i can see the dhcrelay thread:
dhcrelay -d -id ens3 -iu calife3a10a63a6 boots

kubectl logs -f dhcrelay-6465784854-qv4f9 get the output: Forwarded BOOTREQUEST for 52:54:00:48:6c:40 to 10.105.102.184 Discarding packet received on calife3a10a63a6 interface that has no IPv4 address assigned.

i think it's the dhcrelay drop the dhcp-ack
but why
and how can i resolve this ?

with great appreciate.

sheepcat commented 2 years ago

https://github.com/42wim/isc-dhcp/blob/f54a146c7fe88889d60f0c1aa8e6f04707f95223/relay/dhcrelay.c
i check the source code of isc-dhcp, found this:

if (ip->address_count < 1 || ip->addresses == NULL) {
    log_info("Discarding packet received on %s interface that "
         "has no IPv4 address assigned.", ip->name);
    return;
}

i add an ipaddress to the calixxxx veth, the logs in dhcp-relay are disappear, but still cannot capture dhcp-ack in ens3. ip addr add 168.168.168.2/24 dev calife3a10a63a6

is there any way to work around this ?

splaspood commented 2 years ago

@detiber you're probably best equipped to comment on this. Would you mind taking a look?

sheepcat commented 2 years ago

workaround:

  1. add an ipaddress to the calixxxx veth
  2. make the dhcprelay pod crashed
  3. start the dhcprelay process in host

then the dhcp DORA works fine.

TODO: why the dhcprelay is not work in pod.

cprivitere commented 2 years ago

@detiber Do you have time to look at this?

jacobweinstock commented 2 years ago

Hey @sheepcat, sorry for the lack of movement here. Is the workaround you provided, something that can be added to the code base, by chance?

jacobweinstock commented 1 year ago

The https://github.com/tinkerbell/charts repo can now be used to deploy the tinkerbell stack to kubernetes. The sandbox repo, https://github.com/tinkerbell/sandbox, will shortly be updated to integrate the chart repo as well.