This pdf walks you through how service discovery could help us to facilitate inter-service communication in a distributed environment.
We would be targetting how service discovery is achieved in Kubernetes and DC/OS, the leading distributed infra-facilitators
2. Agenda
➔ Why need a distributed environment
➔ What is service discovery
➔ Why do we need service discovery
➔ Service Discovery in DCOS
➔ Service discovery in Kubernetes
➔ Conclusions and observations
3. Why Need A Distributed Environment
➔ ELK stack
➔ Prometheus
➔ Pager Duty
➔ Web Servers
➔ Backend Servers
➔ Databases
◆ Sql
◆ NoSql
➔ Streaming Jobs
➔ Kafka Queues
➔ Zookeeper
And Many More….
5. There Need to be a way ….
We need to answer following :
➔ What mechanism allows services to be called even with constantly
changing hosts in a distributed environment.
➔ How are these services (like microservices) communicating with
each other internally
➔ How the external request/response mechanism works in a
distributed environment
6. Service Discovery To The Rescue
All the questions we just raised could be answered by having a proper
service discovery mechanism.
Service discovery could be defined as a process of finding the network
location of a running service.
In case of distributed systems, the host alloted to a service are dynamic
and keeps on changing. Service discovery make sures that the dynamic
nature of application deployment does not effects the
reachability/availability of the application.
7. Types Of Service Discovery
Service discovery is broadly of 2 types
➔ Client Side Service Discovery
➔ Server Side Service Discovery
9. Concluding
Advantages
➔ Except for the service registry, there are no other moving parts
➔ Intelligent custom application‑specific load‑balancing decisions
Disadvantages
➔ It couples the client with the service registry
➔ Need to implement discovery logic for each programming
language and framework used by the service clients.
11. Concluding
Advantages
➔ Details of discovery are abstracted away from the client
➔ Clients simply make requests to the load balancer.
Disadvantages
➔ Unless the load balancer is provided by the deployment
environment, it is yet another highly available system component
that you need to set up and manage.
12. What is DCOS / Kubernetes All About ?
DEFINITION
A distributed system is a network that consists of autonomous computers that are
connected using a distribution middleware. They help in sharing different
resources and capabilities to provide users with a single and integrated coherent
network.
DCOS(Marathon) and Kubernetes are the the leading distributed orchestration
platforms.
13. Service Discovery In Kubernetes and DCOS
➔ Deployment environments such as Kubernetes and Marathon uses
server side service discovery and run a proxy on each host in the
cluster.
➔ The proxy plays the role of a server‑side discovery load balancer.
➔ In order to make a request to a service, a client routes the request via
the proxy using the host’s IP (public/master node) address and the
service’s assigned port.
➔ The proxy then transparently forwards the request to an available
service instance running somewhere in the cluster.
14. Implementing Service Discovery In DCOS
In DCOS service discovery / load balancing could be implemented in
following ways
DNS based Service Discovery (Used Internally in distributed cluster)
➔ Mesos DNS
➔ DCOS DNS
Load Balancing based Service Discovery
➔ External and Internal Marathon-LB
➔ Virtual IP Addresses (VIPs)
➔ Edge-LB (Enterprise)
16. Mesos DNS VS DCOS DNS
Mesos DNS
➔ All the fully qualified domain name (FQDNs) have the top level
domain (TLD) of .mesos
➔ Only master have the information about all FQDNs
➔ Not a recommended choice.
DCOS DNS
➔ All the fully qualified domain name (FQDNs) have the top level
domain (TLD) of .directory
➔ All the nodes have the information about all FQDNs
➔ Highly Available.
17. VIP Addresses VS External Marathon-LB
Virtual IP Addresses
➔ Used to load balance services inside the DCOS VPN
➔ Services cannot be accessed from outside the DCOS cluster
➔ Generally TCP service ports are accessed
➔ Specified via labels like VIP_0, VIP_1, etc.
External Marathon-LB
➔ Used to load balance services Outside the DCOS VPN
➔ Used to route the traffic like clients REST requests.
➔ Http and Https ports are accessed.
➔ Specified via HAPROXY_GROUP