Service Discovery with Consul - Arunvel Arunachalam as a part of Kubernetes & Cloud Native Online meetup
https://www.meetup.com/k8s-cloudnative-online/events/269930039/
95. Disclaimer
• Rapid Change is the new normal
csemanit2015@gmail.com
arunvel.wordpress.com
https://medium.com/@csemanit2015
Arunvel Arunachalam [Linkedin]
Mob - 9028825645
96. Consul
• Hashicorp 2012
• March 2020 = Hashicorp Joins CNCF
• Packer = Image Builder
• Terraform = IAC Tool
• Vault = Securely Accessing Secrets
• Consul(2014) = (Service Discovery – Service Configuration – Service
Segmentation)
109. Consul
• Each node = Consul Agent
• Consul Agent (Client, Server)
• Client
- Manages registered services & Health check for that Node
- Gossip Protocol (Ping UDP/TCP)
- Forwards Client request to Consul Server
110.
111. Consul Agent - Server
• Client + Additional Functions
• Storing state of Cluster (K/V). Raft consensus Algo
• Forwards client request to Leader Server
112. Gossip Protocol
• GP is based on SWIM (Scalable Weakly-consistent Infection Style
Process Group Membership Protocol = Cornell University
• UDP = To build membership(ping)
• TCP = Use to exchange full details about nodes
113. LAN Gossip
• LAN gossip pool which contains nodes that are all located on the
same local area network or datacenter.
• Consul is built on top of Serf
• SWIM Protocol is implemented via a tool called Serf
• Allows Clients to discover Servers automatically
• Distributing failure detection across entire cluster
• Enabling reliable and fast broadcasting for events (e.g new leader)
114. Serf
• Serf is a tool for cluster membership, failure detection, and
orchestration that is decentralized, fault-tolerant and highly available.
• It is extremely lightweight: it uses 5 to 10 MB of resident memory
115. WAN Gossip
• WAN gossip pool contains only Consul Agent Servers.
• These servers are primarily located in different datacenters and
typically communicate over the internet or wide area network
• Integrates Failure detection, allowing consul agents to decommission
servers
116. Consul Ports
DNS: The DNS server (TCP and UDP) 8600
HTTP: The HTTP API (TCP Only) 8500
HTTPS: The HTTPs API disabled (8501)*
gRPC: The gRPC API disabled (8502)*
LAN Serf: The Serf LAN port (TCP and UDP) 8301
Wan Serf: The Serf WAN port (TCP and UDP) 8302
117. • Client Side Load Balancing = give the client the list of possible endpoints and let it
decide which to call
• Service Discovery = a mechanism for finding the periodically updated list of
healthy end points
• Circuit Breaking = shedding load for a period of time to a service that misbehaves
• Bulk Heading = limits client resource usage with explicit thresholds
118. • Timeouts = enforcing time limitations on requests
• Retries = retrying a failed request
• Retry Budget = applying constraints to retries (can only retry 50% of the calls in a
10s window)
119.
120. Side Car Proxy
Run adjacent to the main service
Running in the same pod
(But as a separate container)
Capable of Handling
- Ingress
- Egress
- Service Discovery
- Circuit Breaker, Timeouts and Retries
- Load Balancing
- Fail Over
121. Coffee with Arun
Q1) Consul Connect is used as Service ------------ .
Q2) Consul Node Communication between two Data Center is called as -------
Gossip
Q3) Consul uses ------------ Protocol to manage membership & broadcast
messages to cluster
Q4) The DNS Server port number in Consul is ----------
Q5) ------ is a decentralized solution for cluster membership, failure
detection, and orchestration