I have a single dedicated server where I have installed a Rancher server and a Rancher client and is used to host some dockerized services.
I have succesfully installed Traefik and it is configured with the Rancher API backend, and it reverse proxies my services, hosting them behind HTTPS and everything is working fine.
But I still access my Rancher server through htttp://12.34.56.78:8080. I would like to also put the Rancher server behind Traefik with https enabled too.
I tried starting the Rancher server with:
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
(the same way I configured all my other services) but it is not picked up by Traefik because (I think) the Rancher Server does NOT appear in the Rancher API requests that Traefik is monitoring (since Rancher server is started outside Rancher and not hosted by it).
Coming from Rancher Active Proxy, this is something that it was supported by that tool
If my reasoning is correct, that Traefik cannot "pick up" the Rancher server that way, an alternative solution I was thinking was that maybe I would have to create a separate [file] section solely for the Rancher server and add it to the Traefik .toml file...
Is this the correct approach to achieve what I want, or is there some better way of doing this...?
Thanks!
I'm almost 2 years late to the party, but I just started rancher with traefik with a [docker] backend.
The docker-compose file for rancher:
version: '3'
services:
web:
image: rancher/rancher:latest
labels:
traefik.enable: true
traefik.backend: rancher
traefik.frontend.entryPoints: http,https
traefik.frontend.passHostHeader: true
traefik.frontend.rule: "Host:rancher.mydomain.com"
traefik.backend.port: 80
traefik.port: 80
restart: unless-stopped
Maybe it's useful for anyone stumbling on this question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With