How can I setup the Kubernetes to work with LoadBalancer on Docker for Windows?
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
kubectl describe service my-nginx
curl -m 10 http://localhost/
curl -m 10 http://localhost:32026/
It does not work, the localhost is not responding. Output I get is:
deployment.apps "my-nginx" created
service "my-nginx" exposed
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
my-nginx LoadBalancer 10.103.126.2 localhost 80:32026/TCP 0s
Name: my-nginx
Namespace: default
Labels: run=my-nginx
Annotations: <none>
Selector: run=my-nginx
Type: LoadBalancer
IP: 10.103.126.2
LoadBalancer Ingress: localhost
Port: <unset> 80/TCP
TargetPort: 80/TCP
NodePort: <unset> 32026/TCP
Endpoints: <none>
Session Affinity: None
External Traffic Policy: Cluster
Events: <none>
curl: (28) Operation timed out after 10000 milliseconds with 0 bytes received
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 tested that I can get inside the pod with kubectl exec pod-name -it -- bash
and I can see that nginx is running in the pod. However it's not accessible from Windows.
I have also 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
This works.
Connection to LoadBalancer in Kubernetes is somehow broken, does it work for others, and any ways to fix this?
Docker for Windows, Version 2.0.0.3 (31259), Channel: stable, Build: 8858db3
The server is listening on the port 32270, try localhost:32270