Hi all,
I have a docker container, where I host 10 tcp services, that are hosted on port 1000-1009. Now I want to create a load balancer using traefik, but I can't get it to work, routing the same load balancer to these 10 "servers" that are all running on the same instance.
The reason, why I want to run 10 services in a single container is, that a single instance of the server requires about 950 MB memory, and running 10 services in this instance only increases the memory usage to about 1 GB. If I would scale them up using Docker I would require 10 GB of Memory allocated, mostly for the environment. Also each of these services can only execute a single request at a time.
When I create my service with these labels:
- "traefik.enable=true"
- "traefik.tcp.routers.cas.rule=HostSNI(
*
)" - "traefik.tcp.routers.cas.entrypoints=cas"
it will only pick up the first exposed port of the container instance, like stated in the doc.
When I create multiple services
- "traefik.tcp.routers.cas.rule=HostSNI(
*
)" - "traefik.tcp.routers.cas.entrypoints=cas"
- "traefik.tcp.routers.cas.service=cas"
- "traefik.tcp.services.cas.loadbalancer.server.port=1000"
- "traefik.tcp.routers.cas2.rule=HostSNI(
*
)" - "traefik.tcp.routers.cas2.entrypoints=cas"
- "traefik.tcp.routers.cas2.service=cas2"
- "traefik.tcp.services.cas2.loadbalancer.server.port=1001"
It will just create multiple loadbalancers
How can I create a loadbalancer with multiple ports, like this?
- "traefik.tcp.routers.cas.rule=HostSNI(
*
)" - "traefik.tcp.routers.cas.entrypoints=cas"
- "traefik.tcp.routers.cas.service=cas"
- "traefik.tcp.services.cas.loadbalancer.server.port=1000-1009"
Also later I want to scale the docker instance aswell, so e.g. 10 replicas mean, that I have a loadbalancer loadbalancing to 100 service instances in 10 docker instances.
Best regards
Mosquito