Hello, I'm reaching out to you to try and find a problem I've been encountering with Traefik for the past few days. I've found several similar topics on this forum, but I haven't found a solution to my problem yet. It's very possible that it's a simple mistake, but an outside perspective would be appreciated.
My Docker Swarm setup consists of 3 manager nodes and 5 worker nodes, with Traefik installed on all three manager nodes.
It is deployed via Ansible like this:
- name: Deployement du service traefik
docker_swarm_service:
name: traefik
mode: global
placement:
constraints:
- node.role == manager
publish:
- { published_port: "80", target_port: "80", protocol: tcp, mode: host }
mounts:
- source: /var/run/docker.sock
target: /var/run/docker.sock
type: bind
read_only: yes
restart_config:
condition: any
delay: 30s
max_attempts: 5
networks:
- "traefik_net"
image: "{{ TRAEFIK_IMAGE }}"
logging:
driver: local
options:
"max-size": 10k
"max-file": "3"
args:
- "--log.level=INFO"
- "--log.format=json"
- "--accesslog=true"
- "--global.checknewversion=false"
- "--api.dashboard=true"
- "--ping=true"
- "--entryPoints.web.address=:80"
- "--entryPoints.mqtt.address=:8883"
- "--ping.entryPoint=web"
- "--providers.docker=true"
- "--providers.docker.swarmmode=true"
- "--metrics.prometheus=true"
labels:
traefik.enable: "true"
traefik.swarmmode: "true"
traefik.docker.network: "traefik_net"
traefik.http.routers.traefik-public-http.rule: "Host(`{{ DOMAINE_TRAEFIK }}`)"
traefik.http.routers.traefik-public-http.entrypoints: "web"
traefik.http.routers.traefik-public-http.service: "api@internal"
traefik.http.services.traefik-public.loadbalancer.server.port: "8080"
when: inventory_hostname in groups['managers_tools'][0]
Beforehand, I created a network:
- name: Création du réseau traefik
docker_network:
name: traefik_net
driver: overlay
attachable: true
internal: false
And finally, I deploy my service:
- name: Deployement du service speedtest
docker_swarm_service:
name: speedtest_service
image: "{{ SPEEDTEST_IMAGE }}"
placement:
constraints:
- node.role == worker
networks:
- "traefik_net"
env:
LS_JAVA_OPTS: "-Xmx512m -Xms512m"
TITLE: "SpeedTest"
labels:
traefik.enable: "true"
traefik.swarmmode: "true"
traefik.docker.network: "traefik_net"
traefik.http.routers.mqtt-speedtest.rule: "Host(`{{ DOMAINE_REQUESTER }}`) && PathPrefix(`/speedtest`)"
traefik.http.routers.mqtt-speedtest.entrypoints: "web"
traefik.http.services.mqtt-speedtest-service.loadbalancer.server.port: "80"
replicas: "{{ SPEEDTEST_REPLICA }}"
when: inventory_hostname in groups['managers_tools'][0]
From what I've understood, the issue often stems from the Docker network, which seems to be correctly configured.
The errors observed in the Traefik logs are:
traefik.0.yefrjzphhdm3@server-manager3 | 192.170.0.26 - - [03/Jan/2024:13:10:10 +0000] "GET /speedtest HTTP/1.1" 504 15 "-" "-" 1537 "speedtest@docker" "http://10.0.4.19:80" 30000ms
traefik.0.mocv9qzoinqu@server-manager1 | 192.170.0.26 - - [03/Jan/2024:13:10:56 +0000] "GET /speedtest HTTP/1.1" 504 15 "-" "-" 1550 "speedtest@docker" "http://10.0.4.19:80" 30000ms
Thank you for any assistance you can provide.
( Sorry for my poor English, I'm using a translator )