Kubernetes hello world (nginx) LoadBalancer does not connect

I have this very simple Kubernetes hello world:

kubectl run my-nginx --image=nginx --replicas=1 --port=80
kubectl expose deployment my-nginx --port=80 --type=LoadBalancer
kubectl get svc
curl -m 10 http://localhost/

However it does not work, the network is not configured properly I think. Output I get is:

deployment.apps "my-nginx" created
service "my-nginx" exposed
NAME         TYPE           CLUSTER-IP     EXTERNAL-IP   PORT(S)        AGE
kubernetes   ClusterIP      10.96.0.1      <none>        443/TCP        55m
my-nginx     LoadBalancer   10.96.89.243   localhost     80:32270/TCP   0s
curl: (28) Operation timed out after 10000 milliseconds with 0 bytes received

the LoadBalancer seems to be there, in external IP but it does not work.

I have additionally tested that connection with Docker images does work just fine:

docker run -dit --rm --name nginx -p 80:80 nginx
curl -m 10 http://localhost/
docker stop nginx

Works just fine.

Kubernetes is somehow broken, does it work for others?

Version 2.0.0.3 (31259)
Channel: stable
Build: 8858db3

I think running “kubectl proxy” should fix your problem.

1 Like

Never used k8s with DfW, but generaly the type loadbalancer is ment to be used with cloud loadbalancers or a baremetal loadbalancer like metallb.

Try to use --type=NodePort instead.