Inside a Kubernetes pod, localhost is the pod, not the host machine. So your pod will never be able to get to something that's localhost-only socket on the host unless you actively expose it or feed it through some other way (i.e. netcat the localhost port to a network port and it could get to that, or mount a directory and have a directory watcher on your host translate files to the localhost service back & forth to the pod).