Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loadbalancing in Swarm from Windows containers to Linux Containers doesnt work #5823

Open
BaseCrusher opened this issue Feb 12, 2025 · 0 comments

Comments

@BaseCrusher
Copy link

BaseCrusher commented Feb 12, 2025

Description

Hello,

Recently I have been trying out Docker Swarm in a mixed node environment, since I have some Windows containers that I need to run. I have multiple Linux containers behind a service, so that the traffic will be load balanced. As long as i access this containers from Linux nodes or the Ingress it is load balanced as expected. But when I call the service from Windows containers, it always takes the first container listed in the service.

Reproduce

  1. Create a swarm with one Linux and one Windows node
  2. Deploy the example compose file as a stack (example file below)
  3. From the Linux Container run curl nginx multiple times. You can see that the load balancing works, since the response is the containers hostname. So it switches between the two nginx containers.
  4. From the Windows container run irm nginx multiple times. You can see that the response is always the same. Even though it should balance the load.

compose file:

services:
  nginx:
    image: nginx:1.27.4
    configs:
      - source: nginx_conf
        target: /etc/nginx/nginx.conf
    deploy:
      mode: replicated
      replicas: 2

  linux:
    image: debian:12.9
    command: ["sh", "-c", "apt-get update -y && apt-get install curl -y && tail -f /dev/null"]
    deploy:
      mode: replicated
      replicas: 1

  windows:
    image: mcr.microsoft.com/windows/server:ltsc2022
    command: "powershell 'while($$true){Start-Sleep -Seconds 60};'"
    deploy:
      mode: replicated
      replicas: 1

configs:
  nginx_conf:
    file: ./nginx.conf

nginx.conf:

events {}

http {
  server {
    listen 80;
    location / {
      default_type text/plain;
      return 200 "$hostname\n";
    }
  }
}

Expected behavior

Load balancing should also work from Windows containers

docker version

Windows node:

Client:
 Version:           27.1.1
 API version:       1.46
 Go version:        go1.21.12
 Git commit:        6312585
 Built:             Tue Jul 23 19:57:57 2024
 OS/Arch:           windows/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          27.1.1
  API version:      1.46 (minimum version 1.24)
  Go version:       go1.21.12
  Git commit:       cc13f95
  Built:            Tue Jul 23 19:56:46 2024
  OS/Arch:          windows/amd64
  Experimental:     false

Linux node:

Client: Docker Engine - Community
 Version:           27.5.1
 API version:       1.47
 Go version:        go1.22.11
 Git commit:        9f9e405
 Built:             Wed Jan 22 13:41:17 2025
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          27.5.1
  API version:      1.47 (minimum version 1.24)
  Go version:       go1.22.11
  Git commit:       4c9b3b0
  Built:            Wed Jan 22 13:41:17 2025
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.7.25
  GitCommit:        bcc810d6b9066471b0b6fa75f557a15a1cbf31bb
 runc:
  Version:          1.2.4
  GitCommit:        v1.2.4-0-g6c52b3f
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

Windows node:

Client:
 Version:    27.1.1
 Context:    default
 Debug Mode: false

Server:
 Containers: 5
  Running: 4
  Paused: 0
  Stopped: 1
 Images: 4
 Server Version: 27.1.1
 Storage Driver: windowsfilter
  Windows:
 Logging Driver: json-file
 Plugins:
  Volume: local
  Network: ics internal l2bridge l2tunnel nat null overlay private transparent
  Log: awslogs etwlogs fluentd gcplogs gelf json-file local splunk syslog
 Swarm: active
  NodeID: muysyf45fu319eb0dg92vbhil
  Is Manager: false
  Node Address: 193.246.152.8
  Manager Addresses:
   193.246.152.34:2377
   193.246.152.35:2377
   193.246.152.41:2377
 Default Isolation: process
 Kernel Version: 10.0 20348 (20348.1.amd64fre.fe_release.210507-1500)
 Operating System: Microsoft Windows Server Version 21H2 (OS Build 20348.3091)
 OSType: windows
 Architecture: x86_64
 CPUs: 4
 Total Memory: 16GiB
 Name: vServer008
 ID: d396a495-8baa-4d9b-811e-f0c0807d3993
 Docker Root Dir: C:\ProgramData\docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

Linux node:

Client: Docker Engine - Community
 Version:    27.5.1
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.20.0
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.32.4
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 11
  Running: 7
  Paused: 0
  Stopped: 4
 Images: 7
 Server Version: 27.5.1
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: active
  NodeID: fpq53gsjyhqa936ovq774v8iw
  Is Manager: true
  ClusterID: osh0r36dqs9e05i7xt8vpag1w
  Managers: 3
  Nodes: 5
  Default Address Pool: 10.0.0.0/8
  SubnetSize: 24
  Data Path Port: 4789
  Orchestration:
   Task History Retention Limit: 5
  Raft:
   Snapshot Interval: 10000
   Number of Old Snapshots to Retain: 0
   Heartbeat Tick: 1
   Election Tick: 10
  Dispatcher:
   Heartbeat Period: 5 seconds
  CA Configuration:
   Expiry Duration: 3 months
   Force Rotate: 0
  Autolock Managers: false
  Root Rotation In Progress: false
  Node Address: 193.246.152.34
  Manager Addresses:
   193.246.152.34:2377
   193.246.152.35:2377
   193.246.152.41:2377
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: bcc810d6b9066471b0b6fa75f557a15a1cbf31bb
 runc version: v1.2.4-0-g6c52b3f
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.1.0-31-amd64
 Operating System: Debian GNU/Linux 12 (bookworm)
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 31.34GiB
 Name: vServer034
 ID: cacd8662-8452-424a-88d0-fcf436faeabb
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Additional Info

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant