我正在尝试在 docker swarm 模式下使用 traefik 2.0 (!)。这是我的堆栈:
version: '3.7'
services:
traefik:
image: traefik:latest
ports:
- 80:80
- 443:443
deploy:
replicas: 1
placement:
constraints:
- node.role == manager
preferences:
- spread: node.id
labels:
- traefik.enable=true
- traefik.http.routers.traefikRouter.rule=Host(`127.0.0.11`)
- traefik.http.routers.traefikRouter.service=api@internal
- traefik.http.routers.traefikRouter.entrypoints=http
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: >
--providers.docker
--providers.docker.exposedbydefault=false
--providers.docker.swarmmode=true
--entryPoints.http.address=":80"
--entryPoints.https.address=":443"
--accesslog
--log.level=DEBUG
--api=true
--api.dashboard=true
networks:
- traefik-public
whoami:
image: containous/whoami
deploy:
replicas: 2
labels:
- traefik.enable=true
- traefik.http.services.whoami.loadbalancer.server.port=80
- traefik.http.routers.whoami.rule=Host(`127.0.0.12`)
- traefik.http.routers.whoami.service=whoami
- traefik.http.routers.whoami.entrypoints=http
networks:
- traefik-public
# Run on Host: docker network create --driver=overlay traefik-public
networks:
traefik-public:
external: true
进入http://127.0.0.12/
有效,我看到了 whoami 页面。
进入http://127.0.0.11/
or http://127.0.0.11/dashboard/
如果我读过,应该显示 traefiks 内部仪表板the docs https://docs.traefik.io/operations/api/#configuration正确的。但我得到 traefiks 404。
The docker service log
显示一个错误:
level=error msg="port is missing" container=traefik-traefik-z8kz9w91yw7pm6tp5os5vxrnv providerName=docker
有什么问题?我怀疑它缺少该服务的端口api@internal
...但那是它的内部服务 - 我无法配置它?!
有任何想法吗?谢谢
好的,只需在标签中添加一个虚拟服务端口就可以了
labels:
- traefik.enable=true
- traefik.http.services.justAdummyService.loadbalancer.server.port=1337
- traefik.http.routers.traefikRouter.rule=Host(`127.0.0.11`)
- traefik.http.routers.traefikRouter.service=api@internal
- traefik.http.routers.traefikRouter.entrypoints=http
我现在已经在 traefik 中挣扎了超过 24 小时......这不可能是解决方案,对吗?
我想我必须将其报告为错误。有人可以确认这不是它应该如何工作吗?
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)