**我正在尝试使用Traefik通过docker swarm平衡我的Web应用程序。 我已经在traefik之后以群体模式安装了诸如joomla之类的示例应用程序。当应用程序与traefik(即管理器)部署在同一节点上时,Joomla可以正常工作,并且我可以通过点击管理器的节点IP来通过浏览器访问它。但是,如果该服务部署在工作节点上,而管理节点中没有容器,则该服务启动并运行时没有任何问题,但是我无法在浏览器上看到任何内容(点击了管理者IP或工作IP)< / p>
My traefik.toml file:
defaultEntryPoints = ["http"]
loglevel = "INFO"
sendAnonymousUsage = true
[docker]
endpoint = "unix:///var/run/docker.sock"
exposedByDefault = false
[api]
dashboard = true
entrypoint = "dashboard"
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.dashboard]
address = ":8080"
--------------------------------
My traefik.yml file:
version: '3'
services:
traefik:
image: traefik:v1.7 # The official Traefik docker image
restart: always
ports:
- 80:80 # The HTTP port
- 9090:8080 # The Web UI (enabled by --api)
labels:
- traefik.frontend.rule=Host:traefik.dpaas1.pune.cdac.in
- traefik.port=8080
- traefik.enable=true
volumes:
- /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events
- ${PWD}/traefik.toml:/etc/traefik/traefik.toml
deploy:
mode: replicated
replicas: 1
restart_policy:
condition: on-failure
max_attempts: 3
placement:
constraints: [node.role == manager]
update_config:
delay: 2s
networks:
- net
networks:
net:
external: true
My joomla.yml file:
version: '3'
services:
joomla:
image: joomla
restart: always
links:
- joomladb:mysql
volumes:
- joomla1-www:/var/www/html
deploy:
mode: replicated
replicas: 3
restart_policy:
condition: on-failure
max_attempts: 3
placement:
constraints: [node.role == manager]
update_config:
delay: 2s
labels:
- traefik.frontend.rule=Host:joomla1.dpaas1.pune.cdac.in
- traefik.port=80
- traefik.enable=true
- traefik.backend.loadbalancer.sticky=true
environment:
JOOMLA_DB_HOST: 10.208.26.162
JOOMLA_DB_PASSWORD: root
tty: true
networks:
- net
networks:
net:
external: true
volumes:
joomla1-www:
_______________________
```_____________ **
My traefik Dashboard:
[![Traefik logs and dashboard][1]][1]
[1]: https://i.stack.imgur.com/tcoGu.png