If a request is made through the ingress for intra-cluster communication, does K8s route using private IPs?

2/17/2021

I have a Service A in a K8s cluster that needs to communicate with Service B via a http request. Unfortunately, we cannot do a call like curl http://serviceb.namespace.svc.cluster.local because we are using Kong as our API gateway, and to take advantage of its auth plugins we need to make requests through the ingress. Thus, we need to make a call like curl https://serviceb.somedomain.com.

I'm trying to understand if there's a downside to this approach. For example, does this cause the request to get routed to the outside world and then back into the cluster, thus causing increased latency? Or is K8s somehow clever enough to route entirely within the vpc of the cluster?

-- Kristoph Matthews
kubernetes

0 Answers