简体   繁体   中英

How should I expose my API URL on a Docker Swarm cluster?

So, I'm starting to play with docker, so far so good, but I got this question on my head.

Having this two statements in mind (please also correct me if I am misunderstanding something):

1) Docker Swarm provides out of the box service discovering, meaning micro services can talk to each other on the same network by service name without actually knowing on which hosts the other services are allocated.

2) Services instances are ephemeral, so a service can be hosted by different machines in a swarm lifespan.

How should I know which ip adress should expose as a central API gateway service, for instance?

You can expose the IP address of any node in the cluster as Docker has a swarm load balancer running on any of the nodes.

在此处输入图片说明

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