文章,博客
by
traefik v2 https router service etcd 边缘 Edge Gateway 博客园
原创+世界唯一声明: 本文是一个真实的例子,通过这个例子,可以配置出一个最简单的https反向代理。 本文世界唯一。我网上搜到其他的例子,都是traefik v1的。或者不是traefik搭配etcd的例子。
写本文目的: 网上应该没有 traefik v2 配 etcd 的例子。
traefik被我喜爱的原因:跨平台,支持win,linux版同时使用。同时支持监控目录和etcd。
答: https://doc.traefik.io/traefik/reference/dynamic-configuration/kv/
https://doc.traefik.io/traefik/routing/providers/kv
答: [providers.etcd] endpoints = “192.168.1.2:2379”
答:
./put-etcdKey.ps1 -endpoint 'http://192.168.1.2:2379' -k 'traefik/http/services/baidushangyou/loadBalancer/servers/0/url' -v 'http://test1.baidu.com:443'
./put-etcdKey.ps1 -endpoint 'http://192.168.1.2:2379' -k 'traefik/http/services/baidushangyou/loadBalancer/servers/1/url' -v 'http://test2.baidu.com:443'
答:
./put-etcdKey.ps1 -endpoint 'http://192.168.1.2:2379' -k 'traefik/http/routers/my-router-https/entryPoints/0' -v 'websecure'
./put-etcdKey.ps1 -endpoint 'http://192.168.1.2:2379' -k 'traefik/http/routers/my-router-https/service' -v 'noop@internal'
./put-etcdKey.ps1 -endpoint 'http://192.168.1.2:2379' -k 'traefik/http/routers/my-router-https/rule' -v 'Host(`test223.com`) && PathPrefix(`/baidu`)'
./put-etcdKey.ps1 -endpoint 'http://192.168.1.2:2379' -k 'traefik/http/routers/my-router-https/middlewares/0' -v 'https-upstream'
./put-etcdKey.ps1 -endpoint 'http://192.168.1.2:2379' -k 'traefik/http/routers/my-router-https/tls' -v 'true'
答:
./put-etcdKey.ps1 -endpoint 'http://192.168.1.2:2379' -k 'traefik/tls/stores/default/defaultCertificate/certFile' -v 'a:/traefik_v2.9.10/test223.cert'
./put-etcdKey.ps1 -endpoint 'http://192.168.1.2:2379' -k 'traefik/tls/stores/default/defaultCertificate/keyFile' -v 'a:/traefik_v2.9.10/test223.key'
答:
./put-etcdKey.ps1 -endpoint 'http://192.168.1.2:2379' -k 'traefik/http/middlewares/https-upstream/redirectRegex/regex' -v '^https://test223.com/baidu$'
./put-etcdKey.ps1 -endpoint 'http://192.168.1.2:2379' -k 'traefik/http/middlewares/https-upstream/redirectRegex/replacement' -v 'https://www.baidu.com'
答:
https://gitee.com/chuanjiao10/powershell/tree/master/gateway_client/traefik
答:
./lib/list-etcdKey.ps1 -endpoints 'http://1.2.3.4:2379'
或
./lib/list-k8sKey.ps1 -endpoints 'http://1.2.3.4:2379'
答:
$v = ./lib/get-etcdkey.ps1 -k 'foo' -endpoints 'http://1.2.3.4:2379'
./lib/put-etcdkey.ps1 -k 'foo' -v $v -endpoints 'http://5.6.7.8:2379'
谢谢观看,完。
tags: