0

I have a Kind cluster installed on my Ubuntu machine. I have deployed few pods on the cluster and can see they're running using kubectl get pods command.

As my pods are some NodeJS services and a react web application, they're all serving on localhost:3000. So I want to reach that address on the cluster and test those pods working fine, but that address doesn't work on my computer and I think I should do some port forwarding maybe, however don't know how?

I want to know how can I reach out localhost:3000 of the locally running Kind cluster and send it http requests?

best_of_man
  • 367
  • 1
  • 3
  • 12
  • 3
    You can't reach `localhost:3000`. If you modify your services so that they are listening on all addresses (`0.0.0.0`) instead of `localhost`, you could use `kubectl port-forward` to access the services (or create a Service and an Ingress resource to allow access from your host, if you have things configured to permit that). – larsks Jan 17 '23 at 01:41
  • 1
    Pedantically, `kubectl port-forward` will still work even with nodejs listening on localhost, but those pods can't communicate with _anything else_ in the cluster, so yes, a pod listening on localhost is a very, very, very frequently asked question around here – mdaniel Jan 17 '23 at 03:36
  • @mdaniel: So what is the way to work/test pods deployed on a local Kubernetes cluster? Only writing automated tests using Jest for example? – best_of_man Jan 17 '23 at 04:40
  • Well, what have you already tried and what outcome is it producing for you? Don't put that in the comments, instead [edit your question](https://serverfault.com/posts/1120399/edit) and include those specifics. The most common way is via an Ingress – mdaniel Jan 17 '23 at 16:59

0 Answers0