不同子网上的 Docker Swarm 节点

不同子网上的 Docker Swarm 节点

我正在尝试在我家里的两台计算机和一台 VPS 之间设置一个 docker swarm,配置如下:

Manager ip:         192.168.1.132/24
Manager second ip:  192.168.100.1/24 (VPN)
First node ip:      192.168.1.131/24
Second node ip:     192.168.100.2/24 (VPN)

docker swarm init --listen-addr 0.0.0.0:2377为了创建我在管理器上使用的群,并为了连接我使用的第一个节点docker swarm join --token TOKEN 192.168.100.1:2377

当我docker swarm join --token TOKEN 192.168.100.1:2377在第二个节点上输入时,它会连接到管理器,但过了一会儿,它就会进入向下状态。

一些复制的服务正在运行,但我不太确定(即 portainer 没有正确显示第二个节点)。

我尝试删除 VPN,但结果显然是一样的。我没有尝试将第一个节点连接到 VPN,因为我认为这只会增加网络开销。第二个节点的 docker 日志如下:

" level=error msg="Failed to join memberlist [192.168.1.132] on retry: 1 error occurred:\n\t* Failed to join 192.168.1.132:7946: dial tcp 192.168.1.132:7946: i/o timeout\n\n"
" level=error msg="agent: session failed" backoff=1.5s error="session initiation timed out" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="manager selected by agent for new session: {v4qwwathmfq02g6pcg267bftu 192.168.1.132:2377}" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="waiting 887.467138ms before registering session" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=error msg="agent: session failed" backoff=3.1s error="session initiation timed out" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="manager selected by agent for new session: {v4qwwathmfq02g6pcg267bftu 192.168.1.132:2377}" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="waiting 3.079456527s before registering session" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=error msg="agent: session failed" backoff=6.3s error="session initiation timed out" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="manager selected by agent for new session: {v4qwwathmfq02g6pcg267bftu 192.168.1.132:2377}" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="waiting 893.272869ms before registering session" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=error msg="Failed to join memberlist [192.168.1.132] on retry: 1 error occurred:\n\t* Failed to join 192.168.1.132:7946: dial tcp 192.168.1.132:7946: i/o timeout\n\n"
" level=error msg="agent: session failed" backoff=8s error="session initiation timed out" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="manager selected by agent for new session: {v4qwwathmfq02g6pcg267bftu 192.168.1.132:2377}" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="waiting 4.256079162s before registering session" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=error msg="agent: session failed" backoff=8s error="session initiation timed out" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="manager selected by agent for new session: {v4qwwathmfq02g6pcg267bftu 192.168.1.132:2377}" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="waiting 7.510543006s before registering session" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=error msg="agent: session failed" backoff=8s error="session initiation timed out" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="manager selected by agent for new session: {v4qwwathmfq02g6pcg267bftu 192.168.1.132:2377}" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="waiting 7.737578398s before registering session" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=error msg="agent: session failed" backoff=8s error="session initiation timed out" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="manager selected by agent for new session: {v4qwwathmfq02g6pcg267bftu 192.168.1.132:2377}" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="waiting 4.645359575s before registering session" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=error msg="agent: session failed" backoff=8s error="session initiation timed out" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="manager selected by agent for new session: {v4qwwathmfq02g6pcg267bftu 192.168.1.132:2377}" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="waiting 6.610075508s before registering session" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="NetworkDB stats vmi361639.contaboserver.net(0b1769452f24) - netID:5selpdsjctbeu6hyvhk13pp2w leaving:false netPeers:1 entries:2 Queue qLen:0 netMsg/s:0"
" level=info msg="NetworkDB stats vmi361639.contaboserver.net(0b1769452f24) - netID:tlwdansnqedavybolyklvlf54 leaving:true netPeers:0 entries:3 Queue qLen:0 netMsg/s:0"
" level=error msg="agent: session failed" backoff=8s error="session initiation timed out" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="manager selected by agent for new session: {v4qwwathmfq02g6pcg267bftu 192.168.1.132:2377}" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="waiting 2.292767564s before registering session" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=error msg="Failed to join memberlist [192.168.1.132] on retry: 1 error occurred:\n\t* Failed to join 192.168.1.132:7946: dial tcp 192.168.1.132:7946: i/o timeout\n\n"
" level=error msg="agent: session failed" backoff=8s error="session initiation timed out" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="manager selected by agent for new session: {v4qwwathmfq02g6pcg267bftu 192.168.1.132:2377}" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="waiting 4.678195176s before registering session" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=error msg="agent: session failed" backoff=8s error="session initiation timed out" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="manager selected by agent for new session: {v4qwwathmfq02g6pcg267bftu 192.168.1.132:2377}" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="waiting 177.932719ms before registering session" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=error msg="agent: session failed" backoff=8s error="session initiation timed out" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="manager selected by agent for new session: {v4qwwathmfq02g6pcg267bftu 192.168.1.132:2377}" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="waiting 3.603526614s before registering session" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=error msg="agent: session failed" backoff=8s error="session initiation timed out" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="manager selected by agent for new session: {v4qwwathmfq02g6pcg267bftu 192.168.1.132:2377}" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="waiting 5.424952674s before registering session" module=node/agent node.id=zc5n9lf9337oxotcdzdmnwcyt
" level=info msg="shutting down certificate renewal routine" module=node/tls node.id=zc5n9lf9337oxotcdzdmnwcyt node.role=swarm-worker
" level=info msg="Node 0b1769452f24/192.168.100.2, left gossip cluster"
" level=info msg="Node 0b1769452f24 change state NodeActive --> NodeFailed"
" level=info msg="Node 0b1769452f24/192.168.100.2, added to failed nodes list"

(输出被截断以仅显示连接问题)我正在考虑切换到 Kubernetes,但我不知道它是否能有效解决我的问题。

我能做什么?提前致谢。

相关内容