I'm setting up a scenario where Ingress (mydomain.com) routes to Service A, which then directs to Pod A, and from there Pod A needs to call Service B, leading to Pod B. The setup works fine for incoming requests, but I'm facing a challenge when Pod B attempts to call mydomain.com. I want that request to somehow route back to Service A or Pod A instead of hitting the Ingress again. I tried creating a service for this, but it doesn't accept dots in the name like mydomain.com. Any ideas on how to achieve this within Kubernetes?
5 Answers
Just a heads up, using the cluster's internal DNS is key. You can rely on internal K8s naming conventions to make these communications easier.
You can achieve this by modifying your setup to use the internal DNS name like SERVICENAME.NAMESPACE.svc.cluster.local instead of the public URL. This way, service calls happen directly within your cluster.
When Pod B wants to reach Pod A, make sure it's using the Kubernetes DNS name for Service A instead of the public domain. This approach helps keep communication internal to the cluster, avoiding potential issues with routing through Ingress again.
Consider adding a rewrite rule in CoreDNS to manage how DNS resolves for your services. That might help in routing requests as you plan.
Also, remember that you should never call the public domain from inside the cluster. Stick to the internal Service DNS names for clean and efficient service communication.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically