Traefɪk是一个为了让部署微服务更加便捷而诞生的现代HTTP反向代理、负载均衡工具。
它支持多种后台(Docker, Swarm, Kubernetes, Marathon, Mesos, Consul, Etcd,
Zookeeper, BoltDB, Rest API, file…)来自动化、动态的应用它的配置文件设置。
快速启动Traefik服务
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| version: '3.7'
services: traefik: image: traefik restart: always labels: - traefik.http.routers.traefik.rule=Host(`traefik.yourdomain.com`) - traefik.http.routers.traefik.entrypoints=web - traefik.http.routers.traefik.service=api@internal - traefik.http.services.traefik.loadbalancer.server.port=8080 command: - --providers.docker - --api.dashboard=true - --entrypoints.web.address=:80 network_mode: host volumes: - /var/run/docker.sock:/var/run/docker.sock
|
使用浏览器打开http://traefik.yourdomain.com
,效果如下: