Traefik 2.0 发布了,包含了很多不错的行特性
tcp 路由(同时也支持sni 路由)
参考配置
tcp:
routers:
to-db-1:
entrypoints:
- web-secure
rule: "HostSNI(`db1.domain`)"
service: "db1"
tls: {}
to-db-2:
entrypoints:
- web-secure
rule: "HostSNI(`db2.domain`)"
service: "db2"
tls: {}
高级路由
方便的支持a/b 测试,流量镜像服务,以及灵活的自定义路由配置(通过Middleware)
a/b 参考配置
http:
services:
canary-api:
weighted:
services:
- name: my-api-v1
weight: 3
- name: my-api-v2
weight: 1
流量镜像参考配置
[http.services.mirrored-api]
[http.services.mirrored-api.mirroring]
service = "api"
[[http.services.mirrored-api.mirroring.mirrors]]
name = "api-v2"
percent = 10
[http.services.api]
[http.services.api.loadBalancer]
[[http.services.api.loadBalancer.servers]]
url = "http://private-ip-server-1/"
[http.services.api-v2]
[http.services.api-v2.loadBalancer]
[[http.services.api-v2.loadBalancer.servers]]
url = "http://private-ip-server-2/"
更好的开发体验
提供了新的api 方便更好的查看请求流量的信息,同时也包含了新的web ui
说明
2.0 还是很值得使用的,新功能很不错