localhost Pod to Pod communication k8s
Are you basically saying that it’s hard coded to “localhost” and you need to somehow change the meaning of “localhost” because you cannot change the source code?

If so, it sounds fairly hard to achieve... but maybe you can override the meaning of localhost in the hosts file of the pod (the right way).

https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/

I feel like this will probably have unintended side effects and may affect kubernetes, but I could be wrong.  It’s definitely worth a try.

Note: the overrides can point to services created over the pod deployments if it works :).  They can have reliable internal domain names that don’t move around.