Reputation: 33
How client can access a deployed microservice without specifing the host agent ip-address and the related mapping port.
If we add Mesos-DNS as the client resolver, we can only obtain agent ip-addresses but it doesn't return the list of microservices instances and their related ports.
Supposed we have three instannces of webapp1 as follow:
+---------+---------+
| agent1 | agent2 |
+---------+---------+
| | |
| ins1:11 | ins3:13 |
| | |
| ins2:12 | |
| | |
+---------+---------+
client should be enabled to access one of instances directly (without referring agent1 and agent2 ip-addresses or those 11, 12 and 13 port numbers). For example:
$ lynx webapp1.marathon.mesos
Upvotes: 3
Views: 167
Reputation: 6371
Take a look at this answer
DNS could provide information about servce port when you make DNS SRV request. It's not compatible with most of clients so you need to manually. Mesos DNS has whole section dedicate to SRV records
Below is an example from docs:
SRV Records
An SRV record associates a service name to a hostname and an IP port. For task
task
launched by frameworkframework
, Mesos-DNS generates an SRV record for service name_task._protocol.framework.domain
, whereprotocol
isudp
ortcp
. For example, other Mesos tasks can discover servicesearch
launched by themarathon
framework with a lookup for lookup_search._tcp.marathon.mesos
:
$ dig _search._tcp.marathon.mesos SRV
; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> _search._tcp.marathon.mesos SRV
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33793
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;_search._tcp.marathon.mesos. IN SRV
;; ANSWER SECTION:
_search._tcp.marathon.mesos. 60 IN SRV 0 0 31302 10.254.132.41.
Mesos-DNS supports the use of a task's DiscoveryInfo for SRV record generation. If no DiscoveryInfo is available then Mesos-DNS will fall back to those "ports" resources allocated for the task. The following table illustrates the rules that govern SRV generation:
Upvotes: 1
Reputation: 688
Please check header X-Marathon-App-Id
with marathon load balancer.
Example:
curl -v -H "X-Marathon-App-Id: /your-app-id-in-marahton" -X GET \
http://marathon-lb.marathon.mesos:9091/yourAppEndPoint
More info marathon-lb docs.
Upvotes: 1