jittering / traefik-kop

A dynamic docker->redis->traefik discovery agent
MIT License
190 stars 14 forks source link

Multiple instances? #12

Closed itsalljustdata closed 1 year ago

itsalljustdata commented 2 years ago

I'd like to have this running on 2 different servers (A & B), feeding data to a traefik instance running on a third (C). It seems. however, that whenever I publish a container to "B" it blats all of the "A" configuration currently registered on "C" (and vice-versa). I'm sharing the redis instance, is this the issue ? Can traefik support multiple redis sources in any case? Thoughts?

chetan commented 2 years ago

@TheFlyingBadger it should work just fine on multiple hosts. Make sure to set a unique hostname for each kop instance using the --hostname flag (or the KOP_HOSTNAME env var). The reason is that we maintain our own internal configuration on redis in the following keys:

1) "traefik_http_routers@hostname"
2) "traefik_http_services@hostname"

If the hostname is not correctly identified, which by default it will not be within docker, then you need to manually pass something in or map it into the container. I'll add an extra note in the README to clarify this.

chetan commented 2 years ago

I just tested again and each container should get a dynamic (random) hostname by default. That should be sufficient for things to work out of the box on multiple nodes. I'll need to investigate a bit more, but perhaps you are already setting the KOP_HOSTNAME to the same string on both nodes? Are the containers on each node also named different in your traefik labels?

Svenum commented 1 year ago

I have now running 2 Treafik-kop instances for 2 months now. Everything is working fine.