corey
corey

Reputation: 310

Unable to reach pod from outside of cluster using exposing external IP via metallb

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?

Upvotes: 3

Views: 1061

Answers (1)

GGorge
GGorge

Reputation: 31

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.

Upvotes: 1

Related Questions