用于内部仪表板的 Traefik 2.0 "port is missing"
Traefik 2.0 "port is missing" for internal dashboard
我正在尝试在 docker 集群模式下使用 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/
或 http://127.0.0.11/dashboard/
应该会显示 traefiks 内部仪表板,如果我没看错 the docs。但是我得到 traefiks 404.
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 小时多了……这不是解决方案,对吧?
我想我必须将此报告为错误。有人可以确认这不是它应该的工作方式吗?
我今天仍然看到这个问题:
修复正在解决它:
- traefik.http.services.justAdummyService.loadbalancer.server.port=1337
我正在尝试在 docker 集群模式下使用 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/
或 http://127.0.0.11/dashboard/
应该会显示 traefiks 内部仪表板,如果我没看错 the docs。但是我得到 traefiks 404.
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 小时多了……这不是解决方案,对吧? 我想我必须将此报告为错误。有人可以确认这不是它应该的工作方式吗?
我今天仍然看到这个问题:
修复正在解决它:
- traefik.http.services.justAdummyService.loadbalancer.server.port=1337