1

I have minikube Load balancer service running on kvm based minikube node. I have below network routes,

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    14     0        0 br0
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
172.18.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker_gwbridge
172.30.32.0     0.0.0.0         255.255.254.0   U     0      0        0 hassio
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 br0
192.168.39.0    0.0.0.0         255.255.255.0   U     0      0        0 virbr0

I could visit the webservice from browser using address http://192.168.39.12:32737/

I need this service to be accessible to the my local network. I tried using iptables to map all the traffic to my host machine with ip addres 192.168.0.11 on port 32737 to 192.168.39.12:32737 using below iptables rules,

$ sudo iptables -I FORWARD -o virbr0 -d  192.168.39.12 -j ACCEPT
$ sudo iptables -t nat -I PREROUTING -p tcp --dport 32737 -j DNAT --to 192.168.39.12:32737
$ sudo iptables -I FORWARD -o virbr0 -d 192.168.0.11 -j ACCEPT
$ sudo iptables -t nat -A POSTROUTING -s 192.168.39.0/24 -j MASQUERADE
sunils@sunils-pc ~ $ sudo iptables -A FORWARD -o virbr0 -m state --state RELATED,ESTABLISHED -j ACCEPT
$ sudo iptables -A FORWARD -i virbr0 -o br0 -j ACCEPT
$ sudo iptables -A FORWARD -i virbr0 -o lo -j ACCEPT

But still I am not able to access my service from my host ip address

$ curl http://192.168.0.11:32737/
curl: (7) Failed to connect to 192.168.0.11 port 32737: Connection refused

Can someone please help me how to expose the minikube service using iptables

Xinus
  • 219
  • 4
  • 13

1 Answers1

1

What about just using socat? It's multiplatform too


nohup socat TCP-LISTEN:443,fork TCP:<ingress address>:443 &
nohup socat TCP-LISTEN:80,fork TCP:<ingress address>:80 &

MM93
  • 11
  • 1