我可以通过托pipe的Traefik容器来服务Rancher服务器吗?

我有一个专用的服务器,我已经安装了Rancher服务器和Rancher客户端,并用于托pipe一些dockerized服务。

我已经成功安装了Traefik,并configuration了Rancher API后端,它反向代理我的服务,托pipe它们后面的HTTPS,一切工作正常。

但是我仍然通过htttp://12.34.56.78:8080访问我的Rancher服务器。 我也想把https服务器放在Traefik后面。

我尝试启动Rancher服务器:

sudo docker run -d \ -v /data/rancher/server/data:/var/lib/mysql \ --restart=unless-stopped \ -p 8080:8080 \ -l traefik.frontend.rule=Host:rancher.mydomainname.com \ -l traefik.enable=true \ -l traefik.backend=rancher \ -l traefik.default.protocol=http \ -l traefik.port=8080 \ rancher/server:v1.6.12 

(与我configuration所有其他服务的方式相同),但不会被Traefik拾取,因为(我认为)Rancher服务器不会出现在Traefik正在监视的Rancher API请求中(因为Rancher服务器在Rancher之外启动,通过它)。

来自Rancher Active Proxy ,这是它被该工具支持的东西

如果我的推理是正确的,那么Traefik不能以这种方式“拾取”Rancher服务器,我想的另一种解决scheme是,也许我必须为Rancher服务器创build一个单独的[file]部分,并将其添加到Traefik .toml文件…

这是实现我想要的正确方法,还是有更好的方法来做到这一点…?

谢谢!

部分回答我的问题

创build一个单独的静态rancherserver.toml文件:

 [backends] [backends.rancherserver] [backends.rancherserver.servers.server1] url = "http://12.34.56.78:8080" weight = 10 [frontends] [frontends.rancherserver] backend = "rancherserver" passHostHeader = true entrypoints = ["https"] [frontends.rancherserver.routes.onlyone] rule = "Host:rancher.mydomain.com" 

(其中12.34.56.78是物理服务器的真实物理IP地址)似乎解决了我的问题,能够通过htttps://rancher.mydomain.com访问Rancher服务器(自动从http转发到https)

由于某种原因,我仍然可以从htttp://12.34.56.78:8080(注意,这不是https)访问Rancher服务器,尽pipe物理服务器防火墙上的所有端口(Ubuntu上的ufw)除了80和433 (和其他一些):

 me@server:~$ sudo ufw status verbose [sudo] password for me: Status: active Logging: on (low) Default: deny (incoming), allow (outgoing), deny (routed) New profiles: skip To Action From -- ------ ---- 22 ALLOW IN Anywhere 443 ALLOW IN Anywhere 80 ALLOW IN Anywhere 1143 ALLOW IN Anywhere 1110 ALLOW IN Anywhere Anywhere on docker0 ALLOW IN Anywhere 22 (v6) DENY IN Anywhere (v6) 443 (v6) ALLOW IN Anywhere (v6) 80 (v6) ALLOW IN Anywhere (v6) 1143 (v6) ALLOW IN Anywhere (v6) 1110 (v6) ALLOW IN Anywhere (v6) Anywhere (v6) on docker0 ALLOW IN Anywhere (v6) 

所以,我仍然认为我滥用Traefik,并允许8080端口泄漏我的Traefikconfiguration… 🙁