1

traefik如何使用文件发现服务02

 1 year ago
source link: http://yongqing.is-programmer.com/posts/216620.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

traefik如何使用文件发现服务02

妙音 posted @ 2023年5月15日 17:58 in 中间件 with tags traefik , 35 阅读
traefik如何使用配置文件发现服务? 
使用docker启动traefik, traefik使用配置文件, 并且服务也使用配置文件
通过docker-compose.yaml引用traefik.yml, config.yml

docker-compose.yaml

version: "3"
services:
reverse-proxy:
#image: traefik:v2.10
image: traefik:latest
ports:
- "80:80"
- "8080:8080"
volumes:
- ./traefik.yml:/etc/traefik/traefik.yml
- ./config.yml:/etc/traefik/config.yml
whoami:
image: containous/whoami
ports:
- "5000:80"

traefik配置文件traefik.yml

api:
insecure: true
...
providers:
file:
filename: /etc/traefik/config.yml

服务发现配置config.yml

http:
routers:
my-router:
rule: "Path(`/whoami/`)"
service: whoami
services:
whoami:
loadBalancer:
servers:
评论 (0)

[取消回复评论]

昵称 登录 E-mail: *
Web:
Twitter:
当有新评论通过 E-mail 通知我
loading captcha image...
(输入验证码)

or Ctrl+Enter


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK