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

Services without exposed ports not registered #11

Open
pasikarkkainen opened this issue Jun 1, 2017 · 5 comments
Open

Services without exposed ports not registered #11

pasikarkkainen opened this issue Jun 1, 2017 · 5 comments

Comments

@pasikarkkainen
Copy link

In rancher-registrator logs I can see these entries for many services/containers:

5/31/2017 7:24:05 PMNo port mappings for
5/31/2017 7:24:05 PMundefined

And those services/containers don't end up registered in Consul.

docker-compose.yml example:

version: '2'
services:
lb:
image: rancher/lb-service-haproxy:v0.6.4
ports:
- 443:443/tcp
labels:
io.rancher.container.agent.role: environmentAdmin
io.rancher.container.create_agent: 'true'
web:
image: nginx:latest
labels:
io.rancher.container.dns: 'true'
io.rancher.container.hostname_override: container_name
redis:
image: redis:3.2.8

And basicly only the "lb" ends up registered in Consul.. it would be nice to be able to get all the other services registered aswell.

@pasikarkkainen
Copy link
Author

Oh, and forgot to mention this happens with Rancher version 1.5.10.

@pasikarkkainen
Copy link
Author

Reading the source of rancher-registrator.. in function checkForPortMapping() it seems the processing only continues if there are exposed ports in the metadata for the service/container.

So I guess that logic should be modified to deal with services/containers that do not expose ports and only use the rancher internal network for communication inside the stack.

@pasikarkkainen
Copy link
Author

pasikarkkainen commented Jun 1, 2017

It seems Rancher currently doesn't support Docker "expose" functionality for defining container-internal ports, which aren't exposed on the host.. so defining "expose" in docker-compose.yml doesn't help getting the services/containers registered to Consul.

One workaround is to use "ports" without defining the host port, ie. one gets random port from the host mapped to the container internal port. Then rancher-registrator registers the container to Consul just fine.. this isn't a perfect solution, but at least it's some kind of a workaround.

Any plans to add support for registering services/containers without "ports" defined? Another nice feature would be the ability to register to container private/internal IP address aswell..

@cabrinoob
Copy link
Owner

The aim of rancher-registrator is to register exposed services in consul in order to be reached from outside the stack network.
So, only services with an exposed port mapped on the host are registered in consul. For internal communication between services without exposed ports you must use the internal DNS of rancher.

@pasikarkkainen
Copy link
Author

It seems current version of Rancher supports "expose" after all in docker-compose.yml, and it seems to work OK.

@cabrinoob : Thanks for the reply. Do you accept new features (PR) to rancher-registrator? I'm thinking of implementing an optional feature (enabled via some label to the service in question) to allow syncing "internal services" to consul aswell.. not only those with published ports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants