简体   繁体   中英

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

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM