NAT not working on VirutalBox with kubernetes, PC -> [ VM -> haproxy -> MetalLB -> Ingress controller -> Kubernetes web server ]
Im trying to connect to a webserver deployed in kubernetes, from outside of the vm. I've connected the pod to an ingress controller and gave the ingress controller a LoadBalancer IP via MetalLB, then created a forward rule in HAproxy to redirect the traffic to the VM IP, and then created a NAT rule in the VirutalBox configuration.
I can, from inside the VM, curl to either localhost or the NIC ip, and it gives back the deployment response, but from my machine (virtualbox host), if i curl to the NATed rule, it fails.
Here's the configuration:
Nat rule:
NAME PROT HOST IP HOST PORT GUEST IP GUEST PORT
Rule 1 | TCP | 192.168.1.5 | 22 | 10.0.2.15 | 22 | (I use this to ssh to the vm)
Rule 2 | TCP | 192.168.1.5 | 80 | 10.0.2.15 | 80 | (This should work for connecting to the web server)
nmcli (or ip addr ): inet 10.0.2.15/24 brd 10.0.2.255 scope global noprefixroute dynamic
haproxy cfg:
frontend haproxy_inbound
bind *:80
default_backend haproxy_httpd
backend haproxy_httpd
server test.minikube 172.17.0.5
kubernetes config:
kubectl get ing
NAME CLASS HOSTS ADDRESS PORTS
wordpress-ingress <none> test.minikube 80
kubectl get svc --all-namespaces
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S)
kube-system traefik-ingress-service LoadBalancer 10.96.170.40 172.17.0.5 80:32547/TCP,8080:32628/TCP
test (inside the vm)
$ curl 172.17.0.5
Hello!
$ curl 10.0.2.15
Hello!
$ curl test.minikube
Hello!
test (outside the vm)
curl 192.168.1.5
curl: (52) Empty reply from server
curl http://192.168.1.5
curl: (52) Empty reply from server
ssh root@192.168.1.5 (i can connect through port 22)
Last login: Sun Sep 27 17:11:10 2020 from gateway
what i am missing? im really lost here
from Recent Questions - Stack Overflow https://ift.tt/2GbM6tB
https://ift.tt/eA8V8J
Comments
Post a Comment