compose2kube
compose2kube copied to clipboard
LoadBalancer
A load balancer config should be created.
One potential approach:
services:
web:
ports:
- "80:8080"
One option may be to use the host port "80" to point to the service port "8080".
A second option would be to add an additional config option specific for compose2kube
e.g.:
services:
web:
ports:
- "8080" # `kube:"LoadBalancerPort:80"`
A third option would be to extract this to a separate config file, which would benefit operational users.
e.g.
services:
web:
ports:
- "8080"
and
loadbalancers:
web:
ports:
- "80:8080"
One problem with the first approach is it breaks docker compose's ability to scale on a single system.
docker-compose scale web=10
Each replicated container will fail to start because they cannot bind to the host port.