bcollard / kind-on-lima-public

source code for the blog post at https://baptistout.net/posts/kubernetes-clusters-on-macos-with-loadbalancer-without-docker-desktop/
27 stars 7 forks source link

make config-network-end-to-end Error when lima0 only have IPV6 assigned :( #4

Open seb-835 opened 7 months ago

seb-835 commented 7 months ago

Hi Thanks a lot for the great work,

i am having an error when running 'make config-network-end-to-end', then it does not permit to reach Metallb LoadBalancer endpoint.

Here is an extract of the logs :

/opt/homebrew/bin/lima -- sh ./lima/35-lima-to-kind-routing.sh
WARN[0000] provisioning scripts should not reference the LIMA_CIDATA variables 
WARN[0000] provisioning scripts should not reference the LIMA_CIDATA variables 
iptables v1.8.7 (nf_tables): host/network `.1' not found

After Investigation, it looks like lima0 interface only have only an ipv6 ? (i have no idea why, do you ?) those it make code :

HOST_IF=lima0
SRC_IP=$(ip -o -4 a s | grep ${HOST_IF} | grep -E -o 'inet [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | cut -d' ' -f2)
SRC_IP_F3B=$(ip -o -4 a s | grep ${HOST_IF} | grep -E -o 'inet [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | cut -d' ' -f2 | cut -d'.' -f1-3)
SRC_IP_GW=${SRC_IP_F3B}.1

to return an empty string for SRC_IP and SRC_IP_F3B and SRC_IP_GW to be assign to ".1", causing the iptable error.

Materials : MacBook Pro M3 - 16Go - MACOS: 14.4.1 (23E224)

seb-835 commented 7 months ago

Hi, i think, i got the workaround to fix lima0 not having an IPV4 assigned .

I got it from https://github.com/lima-vm/lima/issues/1259 We have to apply this on Mac :

sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add /usr/libexec/bootpd
Application at path ( /usr/libexec/bootpd ) added to firewall 
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --unblock /usr/libexec/bootpd

Perhaps we can detect it in the script and make a red readable message as output of "make config-network-end-to-end" ?