工人无法连接到AWS EC2上的Swarm

6

我是AWS EC2的新手,

目标:在EC2上创建3个Ubuntu机器实例,并在第一个实例上初始化Swarm,然后将另外2个实例添加为Swarm的工作节点。

错误:Swarm初始化正常,但将工作节点添加到Swarm时出现错误。

~$ docker swarm join --token SWMTKN-1-4yquvx0xihdhcv0m1vmxmbq4q45hoanm9ig00pue7opx3dhc1s-2ybrjxx97mpjyo351sx8jyisp 172.31.31.41:2377
 Error response from daemon: Timeout was reached before node was joined. The attempt to join the swarm will continue in the background. Use the "docker info" command to see the current swarm status of your node.

~$ docker info
*****
Swarm: error
 NodeID:
 Error: rpc error: code = DeadlineExceeded desc = context deadline exceeded
 Is Manager: false
******

我查看了stackoverflow上相关的问题(Docker 1.12.1: after swarm init, workers unable to join swarm),但这些解决方案在我的情况下无效。

我应该如何使我的另外两个实例加入到集群中?

2个回答

11

这看起来像是您的安全设置出了问题。请确保所有所需端口都已打开。

关于管理者:

Custom TCP Rule TCP 2377    swarm + remote mgmt
Custom TCP Rule TCP 7946    swarm
Custom UDP Rule UDP 7946    swarm
Custom UDP Rule UDP 4789    swarm

关于工人

Custom TCP Rule TCP 7946    swarm
Custom UDP Rule UDP 7946    swarm
Custom UDP Rule UDP 4789    swarm
请参见以下更多详细信息。 https://gist.github.com/BretFisher/7233b7ecf14bc49eb47715bbeb2a2769 还要检查ufw statusiptables -Ssestatus,以确保它们不会阻止访问。

0

只需要进入管理节点 EC2 实例,编辑安全组入站规则并添加允许在端口 2377 上进行 TCP 通信的规则即可。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接