How Can One Pod Call Another Pod or Service with a Specific URL in Kubernetes?

February 25, 2026 4 answers
Asked by Jumblebee
I'm trying to figure out how to connect my services within Kubernetes. The setup I have is: when a user types in 'mydomain.com', Ingress routes the request to Service A, which then communicates with Pod A. From there, Pod A needs to call Service B, which then calls Pod B. However, when Pod B tries to return to the original URL 'mydomain.com', I want it to go back to Service A or Pod A, but not the Ingress directly. I attempted to create a service using the URL 'mydomain.com', but it doesn't allow dots. How can I achieve this routing within Kubernetes?

Answers

journey.90min
Instead of public domains, always reference the Kubernetes services to avoid routing problems. If you have a bit of control over your application calls, that would simplify things a lot!

H3.neighborhood: For sure! Using cluster DNS is key here.

subsection C: You might also want to check out adding a rewrite rule in CoreDNS if you want to tweak DNS resolution.

Reply to this answer
noon.12ish
Try adding a DNS rule in CoreDNS to manage your internal calls more effectively. This can help with services trying to call each other.
Reply to this answer
_beacon_keeper_
When Pod B needs to call Pod A, you'll want to use the Kubernetes DNS name for Service A instead of the public domain. The main thing here is to ensure youโ€™re working within the cluster's networking. Calling the public domain just wonโ€™t work from the cluster.

rOvingReporter: Exactly! Use the format 'SERVICENAME.NAMESPACE.svc.cluster.local' to reach the services without any issues.

82_Coastline: And donโ€™t forget about the internal DNS. Thatโ€™ll help with routing properly between your services.

Reply to this answer
dil1to50
Another approach is to utilize the internal cluster DNS directly. Avoid any references to the public domain inside your clusterโ€”it'll save you a lot of headaches!
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions