Hey everyone! I'm having a little trouble with my Kubernetes setup and could really use some advice. I manually created a pod that runs a small REST API, and it's supposed to be accessible on port 5000. I've also set up a ClusterIP service to link to this pod using the same port. When I port forward my pod to my local machine with the command "kubectl port-forward clientportal 5000:5000", I can hit the API just fine from Postman at localhost:5000. However, when I exec into the pod and try to curl to the same endpoint, I get an "empty reply from server" error. To troubleshoot further, I even created a simple nginx test pod and tried to curl my API pod using its service name SVCNAME.default.svc.cluster.local:5000, but I still hit the same error. Any insight would be greatly appreciated! Thanks!
1 Answer
It sounds like you're running into a weird issue. Just to clarify, when you exec into the pod where your API is running, are you able to curl 127.0.0.1 or localhost from within? If that’s not working, then it might be an issue with the API itself, not Kubernetes. Since it works with port forwarding, double check what IP the API is actually listening on. If it’s not set to 0.0.0.0, you might want to change that setting!

I’m not too clear on how to check what IPs the API is listening on. I ran "netstat -tuln" on my API pod, and it shows that it’s listening on 0.0.0.0:5000. Does that mean everything should be fine?