2

I try to deploy nginx deployment to see if my cluster working properly on basic k8s installed on VPS (kubeadm, ubuntu 22.04, kubernetes 1.24, containerd runtime)

I successfully deployed metallb via helm on this VPS and assigned public IP of VPS to the using CRD: apiVersion: metallb.io/v1beta1 kind: IPAddressPool

NAME              TYPE           CLUSTER-IP       EXTERNAL-IP     PORT(S)                   
nginx             LoadBalancer   10.106.57.195    145.181.xx.xx   80:31463/TCP                 

my target is to send a request to my public IP of VPS to 145.181.xx.xx and get nginx test page of nginx.

the problem is that I am getting timeout, and connection refused when I try to reach this IP address outside the cluster, inside the cluster -everything is working correctly - it means that calling 145.181.xx.xx inside cluster returns Test page of nginx.

There is no firewall issue - I tried to setup simple nginx without kubernetes with systemctl and I was able to reach port 80 on 145.181.xx.xx.

any suggestions and ideas what can be the problem or how I can try to debug it?

corey
  • 300
  • 1
  • 16
  • Are the pods that you are using to reach internally `145.181.xx.xx.` on different servers? I mean if you are reaching `145.181.xx.xx.` from inside the cluster it means that the requests are going outside the cluster and then coming back in – Rico Aug 17 '22 at 04:31
  • @Rico I try to reach internally 145.181.xx.xx on the same VPS machine where kubernetes cluster is installed and I am getting valid result - it means this IP is reachable, i cannot reach this endpoint outside of cluster, from my machine or from the internet – corey Aug 17 '22 at 06:52
  • MetalLB provisions virtual IPs on your local machine, all you are doing is reaching that Virtual IP locally (it's not going out to your network) Are you sure that `145.181.xx.xx.` is routable from the outside? – Rico Aug 17 '22 at 15:00
  • I had the same issue and this has resolved my problem: ```sudo ifconfig wlan0 promisc``` MetalLB layer2 mode doesn't receive broadcast packets unless promiscuous mode is enabled. https://stackoverflow.com/questions/60796696/loadbalancer-using-metallb-on-bare-metal-rpi-cluster-not-working-after-installat – Anton Petrov Feb 11 '23 at 21:21

1 Answers1

1

I'm facing the same issue.

Kubernetes cluster is deployed with Kubespray over 3 master and 5 worker nodes. MetalLB is deployed with Helm, IPAddressPool and L2Advertisement are configured. And I'm also deploying simple nginx pod and a service to check of MetalLB is working.

MetalLB assigns first IP from the pool to nginx service and I'm able to curl nginx default page from any node in the cluster. However, if I try to access this IP address from outside of the cluster, I'm getting timeouts.

But here is the fun part. When I modify nginx manifest (rename deployment and service) and deploy it in the cluster (so 2 nginx pods and services are present), MetalLB assigns another IP from the pool to the second nginx service and I'm able to access this second IP address from outside the cluster.

Unfortunately, I don't have an explanation or a solution to this issue, but I'm investigating it.

GGorge
  • 31
  • 6
  • 1
    This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://stackoverflow.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). Once you have enough [reputation](https://stackoverflow.com/help/whats-reputation), you can also [add a bounty](https://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question. - [From Review](/review/late-answers/33243356) – Ben Cox Nov 28 '22 at 22:42
  • I had the same issue and this answer helped me resolve it: https://stackoverflow.com/questions/60796696/loadbalancer-using-metallb-on-bare-metal-rpi-cluster-not-working-after-installat – Anton Petrov Feb 11 '23 at 21:32