0

Assuming you run a service exposed on port 80 in global mode, will ingress traffic on port 80 for any given node / host then be handled locally by the instance running on that node?

The alternative would be that Swarm load balances the traffic to one of the running instances, regardless of which node it runs on.

sbrattla
  • 1,578
  • 4
  • 28
  • 52

1 Answers1

0

After having experimented a bit with this myself, it appears that this can be achieved with the following configuration.

version: '3.2'

services:
  traefik:
    image: [image]
    ports:
      - target: 80
        published: 80
        protocol: tcp
        mode: host
    deploy:
      mode: global
      endpoint_mode: dnsrr

The important parts are :

  1. Version must be set to 3.2 for the ports section format to be supported.
  2. For each exposed port, set mode to host
  3. In the deploy section, set mode to global and endpoint_mode to dnsrr.

This will expose the service directly on port 80 on each node in the cluster, and traffic will be handled directly by that service.

sbrattla
  • 1,578
  • 4
  • 28
  • 52