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

Detecting exposed ports in images #146

Closed
kadel opened this issue Sep 7, 2016 · 15 comments
Closed

Detecting exposed ports in images #146

kadel opened this issue Sep 7, 2016 · 15 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@kadel
Copy link
Member

kadel commented Sep 7, 2016

One of the issues I'm constantly facing when using Kompose with various docker-compose files is that they don't always specify port. With docker-compose this is not an issue but, for Kompose it is as we need to create service for every exposed port.

We should investigate if it is possible to get exposed ports from image metadata without downloading image itself. Or maybe if there is some other solution for this.

@kadel kadel added enhancement kind/feature Categorizes issue or PR as related to a new feature. labels Sep 7, 2016
@sebgoa
Copy link
Contributor

sebgoa commented Sep 8, 2016

So I looked into this a bit.

Lost of images do not have an exposed port, as you can reach a containerized service on any port even it is not 'EXPOSED'.

So even if we could introspect an image from a repo to figure out the EXPOSE, it may not even have one.

Case in point, the carts image form the sock shop example:

https://github.com/microservices-demo/carts/blob/master/Dockerfile

So I think we gonna have to create services with empty ports :( that will need to be edited by hand.

@sebgoa
Copy link
Contributor

sebgoa commented Sep 8, 2016

yeah that's a problem, as we need a port to create a service. Not sure how to solve this.

We can create a basic service set port to "1" but it won't work.

@kadel
Copy link
Member Author

kadel commented Sep 9, 2016

You are right. I forgot that when they are on the same network it doesn't mater what is in EXPOSE. :-(.

There is one solution that would probably work, but it is really ugly. We can generate Service with all 65536 ports 😆

@dustymabe
Copy link
Contributor

There is one solution that would probably work, but it is really ugly. We can generate Service with all 65536 ports 😆

yeah. that could be our last resort. we could do this by default and then warn the user about this and tell them to either add port definition to docker compose file or edit the generated artifacts to put in the correct port.

@sebgoa
Copy link
Contributor

sebgoa commented Sep 11, 2016

that's pretty much impossible. afaik there is no wildcard for service ports in services. So that would mean creating 65k entries in the port definition of the service (so ugly). Plus pretty sure the proxy would run out of file descriptors somewhere, since it needs to listen on those ports...

@smarterclayton
Copy link

You can create a headless service (clusterIP: "None") and you should not be required to define ports.

@sebgoa
Copy link
Contributor

sebgoa commented Sep 12, 2016

but DNS won't work ?

@smarterclayton
Copy link

DNS works for headless services.

@sebgoa sebgoa self-assigned this Sep 13, 2016
@sebgoa
Copy link
Contributor

sebgoa commented Sep 13, 2016

try this with a headless service:

apiVersion: v1
kind: Service
metadata:
  labels:
    app: sockshop
  name: front-end
spec:
  clusterIP: None
  ports: null
  selector:
    service: front-end

But the endpoint does not seem to get set with the Pod IP matching the selector. Hence no DNS.
I will keep looking into it.

@sebgoa
Copy link
Contributor

sebgoa commented Sep 15, 2016

I have made a fix for this in 96493a5

We need to use a "dummy" port in the headless service creation, otherwise the endpoint does not get populated and DNS entries do not get created.

@surajssd
Copy link
Member

@Runseb how about having a separate PR for this particular thing, rather than having it embedded in the "Socks Shop example"?

@sebgoa
Copy link
Contributor

sebgoa commented Sep 16, 2016

@surajssd ok, I broke things up. #157 addresses the headless service alone.

@surajssd
Copy link
Member

@sebgoa thanks 👍

@cdrage
Copy link
Member

cdrage commented Jan 30, 2017

@kadel #157 has been merged, would this be closed?

@surajssd
Copy link
Member

@cdrage yes this can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

6 participants