Docker-swarm覆盖网络不适用于不同主机中的容器 [英] Docker-swarm overlay network is not working for containers in different hosts

查看:93
本文介绍了Docker-swarm覆盖网络不适用于不同主机中的容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在docker-swarm中遇到网络问题.问题在下面;

  • 我们已经在wmware(vsphere 6.02)上实现了虚拟化环境
  • 我们的服务器是根据vmware创建的,例如server1和server2
  • 我们有一个docker compose文件,定义了一些服务
  • 我们在docker-compose中有一个docker-swarm覆盖网络定义
  • 当我们成功使用docker-swarm部署完成系统部署时,所有容器都从覆盖网络范围获取IP.
  • 但是问题是,如果将2个容器(例如cnt1和cnt2)部署到不同的服务器上,它们将无法彼此ping通
  • 我检查了tcpdump,发现ARP通信成功,因此他们彼此正确地认识了mac
  • 但是当您尝试ping到容器时,会发送ICMP Echo消息,但不会将其传递到第二台计算机.

我应该在哪里查看任何建议?

  server-1:〜$ docker版本客户:版本:17.03.0-ceAPI版本:1.26Go版本:go1.7.5Git提交:3a232c8建成时间:2017年2月28日星期二08:01:32操作系统/Arch:linux/amd64服务器:版本:17.03.0-ceAPI版本:1.26(最低版本1.12)Go版本:go1.7.5Git提交:3a232c8建成时间:2017年2月28日星期二08:01:32操作系统/Arch:linux/amd64实验性:真实 

ps:我检查了这篇文章,但是我有最新版本的docker/docker-swarm,因此该问题应已解决.

ps-2:类似的问题; https://github.com/docker/swarm/issues/2687

解决方案

出于好奇,在您的VMware环境中,您是否已部署NSX?我可能有一个答案,但这仅适用于在环境中部署了NSX的情况.

如果目标端口与为VXLAN VTEP通信配置的端口相同,则

ESXi显然会丢弃来自VM的 OUTBOUND 数据包.

NSX使用端口 4789/udp 进行VXLAN的VTEP通信(默认情况是从6.2.3版本开始;之前是 8472/udp ).(如果虚拟机位于同一主机上,则会丢弃流量,因为尽管可能是 OUTBOUND 流量,但它不会流出主机,也不会得到主机到要删除的VMKernel中的同一阶段.)

KB2079386 中的措辞有点差.它指出:

VXLAN端口8472保留或限制供VMware使用,任何虚拟机均不能将此端口用于其他目的或任何其他应用程序.

但是,它应该显示为:

VTEP端口已保留或限制供VMware使用,任何虚拟机均不能将此端口用于其他目的或任何其他应用程序.

如果使用的是NSX,则可以this post but I have latest version of docker / docker-swarm so the issue should be fixed..

ps-2: similar problem; https://github.com/docker/swarm/issues/2687

解决方案

Out of curiosity, in your VMware environment, do you have NSX deployed? I may have an answer, but it only applies if NSX is deployed in the environment.

ESXi will apparently drop OUTBOUND packets from VMs if the destination port is the same as the port configured for the VXLAN VTEP communication.

NSX utilizes port 4789/udp for VTEP communication for VXLAN (by default, as of 6.2.3; prior to that, it was 8472/udp). (If the VMs are on the same host, then traffic is not dropped, because, while it may be OUTBOUND traffic, it does not egress the host, and does not get to the same stage within the VMKernel to be dropped.)

The wording in KB2079386 is a little off. It states:

VXLAN port 8472 is reserved or restricted for VMware use, any virtual machine cannot use this port for other purpose or for any other application.

But, it should read:

VTEP Port is reserved or restricted for VMware use, any virtual machine cannot use this port for other purpose or for any other application.

If you are using NSX, you could try changing the port used for the VXLAN VTEPs, but port 4789/udp is required if you are going to leverage hardware VTEPs at all.

(I can't take full credit for this. I stumbled across this blog post talking about similar behavior when troubleshooting a similar issue.)

这篇关于Docker-swarm覆盖网络不适用于不同主机中的容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆