0

I am working through the Kind tutorial for local Kubernetes development, and I've reached the section on LoadBalancer configuration. I'm encountering an issue where the service seems to be running but is not accessible either within WSL2 or Windows. Here's what I've tried so far to troubleshoot the issue:

❯ docker network inspect -f '{{.IPAM.Config}}' kind
[{172.18.0.0/16  172.18.0.1 map[]} {fc00:f853:ccd:e793::/64  fc00:f853:ccd:e793::1 map[]}]

❯ kubectl get services foo-service
NAME          TYPE           CLUSTER-IP      EXTERNAL-IP      PORT(S)          AGE
foo-service   LoadBalancer   10.96.133.109   172.18.255.200   5678:30686/TCP   25h

❯ kubectl get pods -o wide
NAME      READY   STATUS    RESTARTS     AGE   IP           NODE                 NOMINATED NODE   READINESS GATES
bar-app   1/1     Running   1 (9h ago)   25h   10.244.0.2   kind-control-plane   <none>           <none>
foo-app   1/1     Running   1 (9h ago)   25h   10.244.0.3   kind-control-plane   <none>           <none>

❯ kubectl run --rm -it --image=nicolaka/netshoot netshot -- /bin/bash
If you don't see a command prompt, try pressing enter.
netshot:~# curl 172.18.255.200:5678
bar
netshot:~# curl 172.18.255.200:5678
foo
netshot:~# exit
exit
Session ended, resume using 'kubectl attach netshot -c netshot -i -t' command when the pod is running
❯ curl -v --max-time 10 172.18.255.200:5678
*   Trying 172.18.255.200:5678...
* Connection timed out after 10000 milliseconds
* Closing connection 0
curl: (28) Connection timed out after 10000 milliseconds

What am I missing? Any guidance on how to resolve this issue would be greatly appreciated.

UPDATE: Additional tests inside the control plane.

user@wsl-host:~$ docker ps
CONTAINER ID   IMAGE                  COMMAND                  CREATED      STATUS          PORTS                                                                 NAMES
<container-id>   kindest/node:v1.27.3   "/usr/local/bin/entr…"   2 days ago   Up 14 minutes   0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 127.0.0.1:33911->6443/tcp   kind-control-plane
user@wsl-host:~$ docker exec -it <container-id> bash
root@kind-control-plane:/# curl 172.18.255.200:5678
foo
Edu
  • 159
  • 1
  • 14
  • could you test `curl 172.18.255.200:30686` and `curl 10.96.133.109:30686` from your machine – AlirezaPourchali Aug 19 '23 at 07:37
  • Nope, I cannot reach the service from the Host Machine, in this case WSL or Windows. That's the curl you see with the "Connection timed out". – Edu Aug 19 '23 at 13:57
  • Can you run ` docker exec -it ` sh` and then run `curl 172.18.255.200:30686 ` and `curl 172.18.255.200:5678`. I want to be certain of something – AlirezaPourchali Aug 19 '23 at 18:05
  • Good point, I tested the url inside the cluster but not inside the control plane. It actually worked inside the kind container. It might related to the docker ports – Edu Aug 19 '23 at 21:36
  • I maped the port as well in the cluster.yaml but it doesn't work either 0.0.0.0:5678->30686/tcp https://kind.sigs.k8s.io/docs/user/quick-start/#mapping-ports-to-the-host-machine – Edu Aug 19 '23 at 22:10
  • you have to map 30686 of the kind container to 30686 of local machine , the 5678 is not the nodeport. Hope that helps! – AlirezaPourchali Aug 20 '23 at 12:41

0 Answers0