networking - Docker-swarm 覆盖网络不适用于不同主机中的容器

标签 networking docker vmware 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 version
        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: true
    

    ps:我查了this post但我有最新版本的 docker/docker-swarm 所以这个问题应该得到解决..

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

    最佳答案

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

    ESXi 显然会放弃 出站如果目标端口与为 VXLAN VTEP 通信配置的端口相同,则来自 VM 的数据包。

    NSX 使用端口 4789/udp 用于 VXLAN 的 VTEP 通信(默认情况下,从 6.2.3 开始;在此之前,它是 8472/udp )。 (如果 VM 位于同一主机上,则不会丢弃流量,因为虽然它可能是 OUTBOUND 流量,但它不会离开主机,也不会到达 VMKernel 内的同一阶段以被丢弃。)

    KB2079386 中的措辞有点偏离。它指出:

    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.



    但是,它应该是:

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



    如果您使用的是 NSX,则可以 try changing the port用于 VXLAN VTEP,但端口 4789/udp 必填 如果您要完全利用硬件 VTEP。

    (我不能完全相信这一点。我偶然发现 this blog post 在解决类似问题时谈论类似行为。)

    关于networking - Docker-swarm 覆盖网络不适用于不同主机中的容器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43933143/

    相关文章:

    python - 无法跟踪 python pcapy 包装器中的错误

    docker - 尝试为plex构建dockerfile

    maven - 如何使用fabric8-maven-plugin标记图像?

    Linux 上的 VMWare - 无法打开/dev/vmmon

    powershell - 使用 powershell 处理字符串中的变量

    linux - airodump-ng 出现故障

    c# - 无法从 WinRT 连接到远程服务器

    ios - iOS Multipeer Connectivity 是否提供路由层?

    spring - 在微服务架构中存储文件的正确方法是什么?

    C# 套接字连接错误