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
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
tasklaunched by frameworkframework, Mesos-DNS generates an SRV record for service name_task._protocol.framework.domain, whereprotocolisudportcp. For example, other Mesos tasks can discover servicesearchlaunched by themarathonframework 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:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With