Traefik v2 [如何路由到特定端口] [英] Traefik v2 [how to route to specific port]
问题描述
我正在尝试更改后端以与traefik v2.0兼容.
I'm trying to start the change of backends to be compatible with traefik v2.0.
我头疼要完成一个简单的任务.旧配置为:
I'm having headache to accomplish a simple task. The old configuration was:
labels:
- traefik.port=8500
- traefik.docker.network=proxy
- traefik.frontend.rule=Host:consul.{DOMAIN}
我认为,不再需要网络了,它将更改以下新的traefik:
I assumed, the network is not necessary anymore, it would change the new traefik for:
- traefik.http.routers.consul-server-bootstrap.rule=Host('consul.scoob.thrust.com.br')
但是我如何设置它应该转发到8500端口的后端?而不是在Traefik到达入口点的80处?
But how I set, that this should forward to my backend at port 8500? and not 80 where the entrypoint was reached at Traefik?
编辑
我的目标是尝试实现以下目标: https://docs.traefik.io/用户指南/集群docker-consul/#migrate-configuration-consul
My goal would try to accomplish something like this: https://docs.traefik.io/user-guide/cluster-docker-consul/#migrate-configuration-to-consul
还有可能吗?我看到在v2.0中没有--consul或storeconfig命令
Is it still possible? I saw, there was no --consul or storeconfig command in v2.0
谢谢,
推荐答案
您需要 traefik.http.services.{SERVICE} .loadbalancer.server.port
labels:
- "traefik.http.services.{SERVICE}.loadbalancer.server.port=8500"
- "traefik.docker.network=proxy"
- "traefik.http.routers.{SERVICE}.rule=Host(`{DOMAIN}`)"
- 用您的服务名称替换
{SERVICE}
. - 用您的域名替换
{DOMAIN}
.
如果要删除代理网络,则需要查看https://docs.traefik.io/v2.0/providers/docker/#usebindportip
If you want to remove the proxy network you'll need to look at https://docs.traefik.io/v2.0/providers/docker/#usebindportip
这篇关于Traefik v2 [如何路由到特定端口]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!