How to connect from one Pod to another using Local IP Address or Pod's host name

7/19/2019

There are two deployments: deployment-A and deployment-B both running on a same cluster. Both deployments are running a single pod with a single container.

The deployment-A's Pod-A's internal IP address is: 172.31.10.211. And it is exposed via port 50000.

podIP: 172.31.10.211
containerPort: 50000

I want to connect to this Pod-A from Pod-B that is running on deployment-B.

But it seems Pod-A is not reachable from Pod-B. Should I create a Service, like a LoadBalancer, for the deployment-A in order to connect to Pod-A via LoadBalancer's public IP address? Would it be possible to use the Pod-A's Local IP instead or Pod-A's hostname?

Is there anything that could be done to make the Pods communicate using Local IPs?

-- alphanumeric
containers
docker
eks
kubernetes
pod

1 Answer

7/19/2019

Create a service for each deployment. You should be able connect the pod through the service. Service type can be clusterIP or nodeport or load balancer. All of them should work

-- P Ekambaram
Source: StackOverflow