1.下载安装traefik
https://github.com/containous/traefik/releases
2.下载安装etcd3
https://github.com/coreos/etcd/releases
3.配置traefik,监控etcd的k-v,traefik使用文档地址 https://docs.traefik.io/master/user-guide/grpc/
[etcd] prefix = "/myservice" watch=true endpoint = "127.0.0.1:2379" #APIV3=true useAPIV3 = true [entryPoints] [entryPoints.http] address = ":8001" //http1,htp2的入口地址 compress = true [entryPoints.bar] address = ":8081" [api] entryPoint = "bar" //admin的入口地址 dashboard = true debug = true
4.将服务信息写入ETCD
put /myservice/backends/backend1/servers/server1/url h2c://backend.local:8080 put /myservice/frontends/frontend1/backend backend1 put /myservice/frontends/frontend1/routes/test_1/rule PathPrefix:/proto.HelloHttp/SayHello
5.启动 SayHello的GRPC服务
6.启动traefik