rancher-sandbox / rancher-desktop

Container Management and Kubernetes on the Desktop
https://rancherdesktop.io
Apache License 2.0
5.7k stars 267 forks source link

Traefik LoadBalancer does not work in WSL #629

Open mattfarina opened 2 years ago

mattfarina commented 2 years ago
$ kubectl --namespace kube-system logs svclb-traefik-hll9m --container lb-port-80
+ trap exit TERM INT
/usr/bin/entry: line 6: can't create /proc/sys/net/ipv4/ip_forward: Read-only file system
+ echo 1
+ true
+ cat /proc/sys/net/ipv4/ip_forward
+ '[' 1 '!=' 1 ]
+ iptables -t nat -I PREROUTING '!' -s 10.43.3.232/32 -p TCP --dport 80 -j DNAT --to 10.43.3.232:80
+ iptables -t nat -I POSTROUTING -d 10.43.3.232/32 -p TCP -j MASQUERADE
+ '[' '!' -e /pause ]
+ mkfifo /pause

$ kubectl --namespace kube-system logs svclb-traefik-hll9m --container lb-port-443
+ trap exit TERM INT
/usr/bin/entry: line 6: can't create /proc/sys/net/ipv4/ip_forward: Read-only file system
+ echo 1
+ true
+ cat /proc/sys/net/ipv4/ip_forward
+ '[' 1 '!=' 1 ]
+ iptables -t nat -I PREROUTING '!' -s 10.43.3.232/32 -p TCP --dport 443 -j DNAT --to 10.43.3.232:443
+ iptables -t nat -I POSTROUTING -d 10.43.3.232/32 -p TCP -j MASQUERADE
+ '[' '!' -e /pause ]
+ mkfifo /pause
jandubois commented 2 years ago

As has been pointed out on Slack, the logs are perfectly normal. /proc/sys/net/ipv4/ip_forward cannot be changed, but as the lines below show, it is already set to the desired value (1), so the error is benign.

mattfarina commented 2 years ago

After digging into this more, it may be me personally that's having the problem. More to follow.

The gist is that I have rules in iptables not from Kubernetes or containerd within Rancher Desktop for ports 80 and 443. The LoadBalancer is listening everywhere but localhost. It appears the issue is with these rules I need to track down.