This is my initial proxy configuration
version: "3.8"
services:
traefik:
image: "traefik:latest"
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--providers.docker.swarmMode=true"
- "--entrypoints.web.address=:80"
- "--accesslog"
- "--log.level=DEBUG"
- "--api=true"
ports:
- "80:80"
- "8080:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
deploy:
placement:
constraints:
- node.role == manager
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik-net"
- "traefik.http.services.api.loadbalancer.server.port=8080"
- "traefik.http.routers.api.rule=Host(`traefik.mydomain.test`)"
- "traefik.http.routers.api.service=api@internal"
- "traefik.http.routers.api.entrypoints=web"
networks:
- traefik-net
networks:
traefik-net:
external: true
my service
version: '3.8'
services:
myapp:
image: myapp
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik-net"
- "traefik.http.routers.myapp.rule=Host(myapp.test.com`)"
- "traefik.http.routers.myapp.service=myapp"
- "traefik.http.services.myapp.loadbalancer.server.port=3000"
- "traefik.http.routers.myapp.entrypoints=web"
- "traefik.http.services.myapp.loadbalancer.passhostheader=true"
deploy:
placement:
constraints:
- node.hostname == nodeworker1
networks:
- traefik-net
networks:
traefik-net:
external: true
My Network
my result:
404 page not found
time="2024-02-09T18:33:19Z" level=debug msg="Filtering disabled container" providerName=docker container=my-service-unqervjxzi143lb7yykfuay5r
It works correctly for me only when both services run on the same node.!
Could you help me correct my error, my logic is to have Trafik only on the master node and the other services on the worker nodes.