admin管理员组文章数量:1244247
The basic example for routing in the configuration is
version: "3"
services:
my-container:
# ...
labels:
- traefik.http.routers.my-container.rule=Host(`example`)
my-container
is the name of the service and it is mentioned in the rule.
The example for multiple routes is different:
version: "3"
services:
my-container:
# ...
labels:
- traefik.http.routers.www-router.rule=Host(`example-a`)
- traefik.http.routers.www-router.service=www-service
- traefik.http.services.www-service.loadbalancer.server.port=8000
- traefik.http.routers.admin-router.rule=Host(`example-b`)
- traefik.http.routers.admin-router.service=admin-service
- traefik.http.services.admin-service.loadbalancer.server.port=9000
Here the name of the service is not mentioned and made-up (?) names are used.
Does this mean that what is between routers
and rule
does not matter?
In other words could I always have (for all my containers) the same name, such as
(in one container)
traefik.http.routers.X.rule=Host(`example`)
(in another container)
traefik.http.routers.X.rule=Host(`foo`)
The basic example for routing in the configuration is
version: "3"
services:
my-container:
# ...
labels:
- traefik.http.routers.my-container.rule=Host(`example`)
my-container
is the name of the service and it is mentioned in the rule.
The example for multiple routes is different:
version: "3"
services:
my-container:
# ...
labels:
- traefik.http.routers.www-router.rule=Host(`example-a`)
- traefik.http.routers.www-router.service=www-service
- traefik.http.services.www-service.loadbalancer.server.port=8000
- traefik.http.routers.admin-router.rule=Host(`example-b`)
- traefik.http.routers.admin-router.service=admin-service
- traefik.http.services.admin-service.loadbalancer.server.port=9000
Here the name of the service is not mentioned and made-up (?) names are used.
Does this mean that what is between routers
and rule
does not matter?
In other words could I always have (for all my containers) the same name, such as
(in one container)
traefik.http.routers.X.rule=Host(`example`)
(in another container)
traefik.http.routers.X.rule=Host(`foo`)
Share
Improve this question
asked Feb 16 at 7:38
WoJWoJ
30k58 gold badges213 silver badges401 bronze badges
1 Answer
Reset to default 1You need to use different names for Traefik routers
, middlewares
and services
- otherwise you are overwriting existing ones across Docker services.
本文标签: traefikDoes naming matters when creating a routing ruleStack Overflow
版权声明:本文标题:traefik - Does naming matters when creating a routing rule? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1740213953a2242520.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论