Docker 1.12 跨节点端口转发服务

Docker 1.12 Port Fowarding Services Across Nodes

所以我的 Docker 集群上有一个 Plex 服务器 运行ning!!如果我神奇地杀死一个节点,它会在其他地方启动 Plex。这很棒!现在是有趣的部分...

使用老式容器,我只需将路由器上的转发端口 32400 端口连接到 运行ning Plex 服务器,它就可以找到。现在 Plex 可以 运行 在多个不同的地方我需要弄清楚如何将端口转发到一些静态资源。我可以使用 HAProxy 绑定一些桥接接口并 运行 它在每个节点上以提供故障转移......但我想看看是否有更简单的方法来完成这个。

在 Docker Swarm 中将端口转发到服务的最佳方式是什么?

端口转发内置于新的 swarm 模式中。文档中有一个section on load balancing

The swarm manager uses ingress load balancing to expose the services you want to make available externally to the swarm. The swarm manager can automatically assign the service a PublishedPort or you can configure a PublishedPort for the service in the 30000-32767 range.

External components, such as cloud load balancers, can access the service on the PublishedPort of any node in the cluster whether or not the node is currently running the task for the service. All nodes in the swarm cluster route ingress connections to a running task instance.

Swarm mode has an internal DNS component that automatically assigns each service in the swarm a DNS entry. The swarm manager uses internal load balancing to distribute requests among services within the cluster based upon the DNS name of the service.


更新

以下文章讨论了如何将代理负载平衡器集成到 docker 引擎中