简体   繁体   English

我应该如何在Docker Swarm集群上公开我的API URL?

[英]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. 因此,到目前为止,我已经开始与docker一起玩,但是我已经想到了这个问题。

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. 1)Docker Swarm提供了开箱即用的服务发现功能,这意味着微服务可以通过服务名称在同一网络上相互通信,而无需实际知道其他服务在哪台主机上分配。

2) Services instances are ephemeral, so a service can be hosted by different machines in a swarm lifespan. 2)服务实例是短暂的,因此服务可以在群集寿命中由不同的机器托管。

How should I know which ip adress should expose as a central API gateway service, for instance? 例如,我如何知道应该将哪个IP地址公开为中央API网关服务?

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. 您可以公开集群任何节点的IP地址,因为Docker在任何节点上都运行着大量swarm load balancer

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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