Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for service namespace in swarm mode #25369

Open
PanJ opened this issue Aug 3, 2016 · 2 comments
Open

Support for service namespace in swarm mode #25369

PanJ opened this issue Aug 3, 2016 · 2 comments
Labels
area/networking area/swarm kind/enhancement Enhancements are not bugs or new features but can improve usability or performance.

Comments

@PanJ
Copy link

PanJ commented Aug 3, 2016

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 and production. Each of them has 2 services, backend and frontend. frontend service must be able to communicate to backend using http://backend:port/some/path/to/api. In docker swarm, I have to create 2 different services like staging-backend and production-backend. The api must be accessed by http://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 and hostname (must be unique throughout the cluster). Container can access service in the same namespace using hostname, and can access a service across namespace using hostname.namespace, while the unique service_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!

@thaJeztah
Copy link
Member

Perhaps implementing --network-alias or similar would be a start; there's already an issue for tracking that; #24787

@thaJeztah thaJeztah added kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. area/networking area/swarm labels Aug 3, 2016
@PanJ
Copy link
Author

PanJ commented Aug 3, 2016

Thanks for pointing out! After looking through docker run command options, --network-alias is really the closest one.

Anyway, ability to resolve something like <service-name>.<namespace> or even <task-id>.<service-name>.<namespace> is something very useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/networking area/swarm kind/enhancement Enhancements are not bugs or new features but can improve usability or performance.
Projects
None yet
Development

No branches or pull requests

2 participants