Docker群集覆盖 – encryptionnetworking和防火墙

我使用5台Ubuntu 16.04服务器在Digital Ocean上build立了一个群集。 他们都使用相同的Docker引擎版本和防火墙规则。 它被设置为使用3个经理。

Client: Version: 17.03.0-ce API version: 1.26 Go version: go1.7.5 Git commit: 3a232c8 Built: Tue Feb 28 08:01:32 2017 OS/Arch: linux/amd64 Server: Version: 17.03.0-ce API version: 1.26 (minimum version 1.12) Go version: go1.7.5 Git commit: 3a232c8 Built: Tue Feb 28 08:01:32 2017 OS/Arch: linux/amd64 Experimental: false 22 ALLOW Anywhere Anywhere/esp on eth1 ALLOW Anywhere/esp 2377/tcp on eth1 ALLOW Anywhere 7946 on eth1 ALLOW Anywhere 4789 on eth1 ALLOW Anywhere 2376/tcp ALLOW Anywhere 22 (v6) ALLOW Anywhere (v6) Anywhere/esp (v6) on eth1 ALLOW Anywhere/esp (v6) 2377/tcp (v6) on eth1 ALLOW Anywhere (v6) 7946 (v6) on eth1 ALLOW Anywhere (v6) 4789 (v6) on eth1 ALLOW Anywhere (v6) 2376/tcp (v6) ALLOW Anywhere (v6) app01 Ready Active app04 Ready Active Reachable app03 Ready Active Reachable app06 Ready Active Leader app05 Ready Active 

我正在为我的服务使用encryption的networking。

 [ { "Name": "jupiter", "Id": "en4gdr54yw4w2xmo34fttdbvg", "Created": "0001-01-01T00:00:00Z", "Scope": "swarm", "Driver": "overlay", "EnableIPv6": false, "IPAM": { "Driver": "default", "Options": null, "Config": [] }, "Internal": false, "Attachable": false, "Containers": null, "Options": { "com.docker.network.driver.overlay.vxlanid_list": "4097", "encrypted": "true" }, "Labels": null } ] 

我创build了我的群居住在eth1 。 例如: docker swarm init --listen-addr eth1:2377 --advertise-addr eth1:2377

尽pipe这个设置我的3个服务不能看到对方。 就好像DNS在群内不起作用一样。 我在github上find了这个链接 ,描述了我正在发生的事情。

我的一个服务尝试使用mongo servicename:port连接到mongo服务。 但是由于服务连接不能达到mongo,所以失败了。 现在我试图通过使用https://hub.docker.com/r/nicolaka/netshoot/连接内部容器来解决问题,并显示容器可以交互。 (但是我不认为它是通过为它设置的encryption连接的。)

我认为它一定是防火墙,但我不是一个networking安全方面的专家,所以我想知道如果我失去了一些东西。 我试图比较一下我的问题26523中关于防火墙的内容。

无论如何,我决定创build另一个没有encryption的networking,并把我的服务放在上面。

现在蒙戈正在接收连接:

 2017-07-17T14:17:53.267+0000 I NETWORK [conn8] received client metadata from 10.0.1.7:33424 conn8: { driver: { name: "nodejs", version: "2.2.29" }, os: { type: "Linux", name: "linux", architecture: "x64", version: "4.4.0-62-generic" }, platform: "Node.js v6.11.1, LE, mongodb-core: 2.1.13" } 2017-07-17T14:17:53.369+0000 I NETWORK [thread1] connection accepted from 10.0.1.7:33426 #9 (3 connections now open) 2017-07-17T14:17:53.373+0000 I NETWORK [conn9] received client metadata from 10.0.1.7:33426 conn9: { driver: { name: "nodejs", version: "2.2.29" }, os: { type: "Linux", name: "linux", architecture: "x64", version: "4.4.0-62-generic" }, platform: 

我想弄清楚如何让encryption的networking工作。 它是防火墙,在我看来,还是Ubuntu服务器丢失了一个包? ; <

离开这一段时间后,我决定再次访问。 有时候离开帮助。

我现在正在工作。 我决定增加一个额外的规则,特别是。

ufw allow to <local host eth1 ip> proto esp

ufw status

 Anywhere/esp on eth1 ALLOW Anywhere/esp 2377/tcp on eth1 ALLOW Anywhere 7946 on eth1 ALLOW Anywhere 4789 on eth1 ALLOW Anywhere 2375/tcp on eth1 ALLOW Anywhere 10.xx.xx.xx/esp ALLOW Anywhere 2376/tcp on eth1 ALLOW Anywhere 22 (v6) ALLOW Anywhere (v6) Anywhere/esp (v6) on eth1 ALLOW Anywhere/esp (v6) 2377/tcp (v6) on eth1 ALLOW Anywhere (v6) 7946 (v6) on eth1 ALLOW Anywhere (v6) 4789 (v6) on eth1 ALLOW Anywhere (v6) 2375/tcp (v6) on eth1 ALLOW Anywhere (v6) 2376/tcp (v6) on eth1 ALLOW Anywhere (v6)