What's the magic behind api@internal

Hi traefik community,

I'm using traefik on a docker swarm.
I have been trying to understand why traefik uses a service called api@internal, and where does it come from. From what I understand it was created for the sole purpose of exposing the dashboard from the same container as the container where all the service discovery stuff is handled . I could not find any explanation online except from basically "use it to make it work".

  • What does api means? Cannot it be something else?
  • What does the @ do?
  • Same questions with internal

I would like to know if this concept is very specific to the dashboard and exists only for technical reasons, or if this concept could / should be applied on other containers as well.

Thank you for your answer

Hello,

There are 2 concepts behind this:

  • a pure Traefik concept: the internal provider namespace
  • a more global container: the provider namespace

The global notion of the provider namespace is a way to reference a element from a provider to another provider.

https://docs.traefik.io/v2.1/middlewares/overview/#provider-namespace

api@internal is a not a container concept, it's a pure Traefik concept, so it cannot be applied to other thing than Traefik it-self.

Ok I get it, I didn't search for the namespace keyword. This makes sense now.

I assume it does not work only with middlewares then. A router in some provider must be able to refer to a service defined with another provider (I guess this is what's happening with api@internal, api being the service name defined internally)