Score:0

How to access pods from local terminal?

pl flag

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?

pt flag
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).
in flag
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
best_of_man avatar
pl flag
@mdaniel: So what is the way to work/test pods deployed on a local Kubernetes cluster? Only writing automated tests using Jest for example?
in flag
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
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.