Support for service namespace in swarm mode #25369
Labels
area/networking
area/swarm
kind/enhancement
Enhancements are not bugs or new features but can improve usability or performance.
In Docker >= 1.12, service discovery and load balancing is cool. But there is a use case which I still need while migrating out of Rancher.
In swarm mode, you can create an overlay network and attach it to a service. Then services inside the network will be discovered/load-balanced through DNS queries using service name. The service name must be unique throughout the entire swarm cluster.
What I need is a way to use the same hostname in different services. Let's say we have 2 environment,
staging
andproduction
. Each of them has 2 services,backend
andfrontend
.frontend
service must be able to communicate tobackend
usinghttp://backend:port/some/path/to/api
. In docker swarm, I have to create 2 different services likestaging-backend
andproduction-backend
. The api must be accessed byhttp://staging-backend:port/some/path/to/api
only.It would be great if all services connect to a single overlay network by default (service name is unique anyway) and provide a way to define
namespace
andhostname
(must be unique throughout the cluster). Container can access service in the same namespace usinghostname
, and can access a service across namespace usinghostname.namespace
, while the uniqueservice_name
is still accessible.This would enhance the flexibility of cluster networking in docker swarm mode. I did not use previous docker swarm before but when I learned about docker swarm mode, I thought that it is the way container orchestration should be (native and complete).
If there is any existing solution or workaround, I really would like to know. In the meantime, I guess I have to refactor the code to make it compatible with docker swarm mode.
Thanks!
The text was updated successfully, but these errors were encountered: