Closed Radek44 closed 8 years ago
You could try hitting the CSV endpoint, which may give you what you're looking for, provided you filter out the unwanted entries. Here's an example of something that does this programmatically: https://github.com/mesosphere/marathon-lb/blob/master/bluegreen_deploy.py#L147-L180
Thank you @brndnmtthws - to ask my question slightly differently - marathon-lb being a service-discovery and load balancing tool, I was wondering what is the best approach for the service-discovery part? Thanks!
To use it as an SD tool, you'd map services to ports (service ports). This only works for TCP-based services, and those which don't mind being tunneled through a proxy.
Additionally for http based services (HAPROXY_0_MODE: http
) there's a listener on tcp/9091 which parses a X-Marathon-App-Id header. This allows you to find the correct backends without requiring a domainname (HAPROXY_0_VHOST
).
So if you have an app /myapp you can request
GET / HTTP/1.1
X-Marathon-App-Id: /myapp
and marathon-lb will route the request to the correct backends without the need for DNS changes.
Brilliant! Exactly what I was looking for @lloesche .
Not sure if this capability already exists and i'm just missing it - if so please let me know how to use it. It would be great if marathon-lb exposed an api endpoint to query the current apps that are registered and obtain the assigned ports.
For example, assuming a
marathon-lb-internal.marathon.mesos
deployment, being able to:curl http://marathon-lb-internal.marathon.mesos/v1/apps
that would return as a minimum the list of known apps and their current marathon-lb service port