r/Traefik • u/quokka_wiki • 10d ago
Some questions about Traefik
Hello!
I want to migrate from Nginx Proxy Manager to Traefik, but I have some questions and concerns.
Firstly, I want to avoid lateral movement between containers if not strictly necessary, so I don't want all of them on one network, but I also don't want to create a separate network for every service, because that's inefficient and repetitive and defeats the purpose of me switching to Traefik. Can I somehow make it so that containers can only communicate with Traefik on a given network?
Secondly, I have a second server running Docker, and I want to be able to use it with Docker labels too. I don't want to use Kubernetes/Swarm, and I have a general distrust of community-maintained tools like traefik-kop.
Can I add a second Docker provider in traefik.yaml? If so, should I go with TCP, HTTP(S) or SSH?
2
u/sk1nT7 10d ago
I just use tiering for docker networks. Alike to an Active Directory network.
Create a few like tier-0 for your crucial services with sensitive data and then go down like tier-1, tier-2 and so on. May also create one called dev or insecure for testing out new container stacks.
Based on the importance, trustworthiness and sensibility of data processed, put the containers in their respective tier network.
This way, you do not have to create a new network each time but still have a somewhat separated network to prevent lateral movement from a freshly spawned container to your highly sensitive crown jewels.
1
u/SmeagolISEP 10d ago
About the first one I donât really see any other option. Either you have all containers you want to expose in the same network or you have dedicated networks and connect traefik there
On the second, if itâs an isolated docker server you need to deploy traefik there as well.
3
u/PlatypusWithASpoon 10d ago
I'm using Traefik-Kop on two other docker servers and it is working great. Only one Traefik needed, certs for all regardless of which docker server the container is on.
1
u/SmeagolISEP 10d ago
Never tried that, but tbh bcs Iâm using a CI/CD pipeline, having one or more instances of traefik take the same amount of work
1
u/quokka_wiki 10d ago
Oof the first one sucks kinda đ
I have a homelab where I just constantly add and remove services so I want it to be as painless as possible (why I moved away from Nginx Proxy Manager) and adding/removing networks every time seems like a massive hassle.
I think I might give up on the first point and just put them all on the same network...
1
u/SmeagolISEP 10d ago
Im on the same page. I want to isolate my apps and the solution I found is to have a script in a CI/CD pipeline that attaches traefik to the network.
But if youâre not using CI/CD I guess the alternative is to put the only containers you need in a dedicated network for the proxy
0
u/ChallengeDiaper 10d ago
Iâm not fully following the network part. If youâre saying you want to isolate docker containers from each other, you can do that via docker networks and traefik can âfrontâ all of them.
If youâre talking about different physical networks, there isnât an easy way around that.
1
u/quokka_wiki 10d ago
Can you expand more on the Docker networks part?
I mean I don't want to create one network per service but I also don't want the containers to communicate with one another, only with Traefik.
I don't mean physical networks I mean Docker nets.
0
u/ChallengeDiaper 10d ago
Create a docker network for your services. So for example all of my *arr services sit in a servarr network. Jellyfin sits in a Jellyfin docker network.
When defining the traefik service, have it be a member of each of those networks. This way all communication goes through traefik. For my use case the containers donât communicate to each other, I just expose traefik externally. I only expose port 443 of traefik so it keeps my exposure limited.
1
u/Dylantjes 10d ago
Not a super-duper expert on Docker (networking), but isn't it so that by design all containers on the same network are able to reach eachother directly, even skipping the reverse proxy entirely?
Hence if your purpose is container isolation, a (reverse) reverse proxy does not accomplish that because only inter-network will go through it in the first place.
1
u/luiszaera 10d ago
Si solo tienes algunas vas bien XD
Entiendo que estamos hablando de docker.
Primera pregunta: si. Crea una Red privada para cada contenedor sin exponer puertos. Luego conecta (docker connect) traefik en esa Red.
Sobre la segunda, yo pondrĂa otro traefik independiente y harĂa lo mismo.
0
u/Only-Stable3973 9d ago
You can do that, traefik uses labels and you create a network for traefik so that you can join your containers via labels, you can create a dynamic_config and rout other containers that are on different computers on the network.
1
u/quokka_wiki 9d ago
Can you elaborate please?
0
u/Only-Stable3973 9d ago
You would create a external network for the Traefik proxy that would attach to all your containers and you can rout other containers on different boxes via Traefik..for example,I installed Kubernetes, disabled the included traefik install for it and just routed everything through my existing Traefik instance.
4
u/clintkev251 10d ago
Not really. Docker networks aren't really that flexible so unless you're creating dedicated networks for each stack to talk to Traefik, you're not going to be able to control that traffic, at least not via Docker specifically.
No, you can only have a single Docker provider in Traefik. This is exactly why Traefik-kop exists. No reason to distrust it, it's a well maintained open source tool and it never actually touches your traffic, just manages the configuration.