How to loadbalance applications in swarm cluster with overlay networking

I tried running tutum/haproxy to loadbalance some web containers on a swarm cluster with overlay networking and found that its not working. Reason being --link not working on overlay networking.

version: '2'

services:
  web:
    image: tutum/hello-world
    expose:
      - "80"
  proxy:
    image: tutum/haproxy
    ports:
      - "80:80"
    links:
      - web
    environment:
      - BACKEND_PORT=80
      - BALANCE=roundrobin

What is the best approach to load balance containers keeping scaling in mind.

Thanks in advance.

1 Like