Search code examples
dockerdocker-composedockerfiledocker-swarmtraefik

Traefik: Load balance internal service without exposing it outside


Currently, I have a frontend, backend, and tf-serving service. My current configuration exposes both frontend and backend services outside.

The service tf-serving, however, is an internal service only used by the backend service. They communicate using the gRPC API provided by TensorFlow Serving.

Would it be possible for tf-serving to be load balanced too such that when I call it from the backend service, Traefik will load balance it for me?


Solution

  • Yes, it is possible. A better approach however, is to connect tf-serving service to the same network as your backend service (or create a separate network just for the two of them) and connect to it directly from backend using container name dns resolving.