Hello Readers, In this blog, we’ll learn about Consul Service Mesh and why Consul Connect and
how it works, and the features provided by HashiCorp.
What is HashiCorp?
HashiCorp is a software company with a freemium business model based in San Francisco,
California. HashiCorp provides open-source tools and commercial products that enable
developers, operators, and security professionals to provision, secure, run and connect cloud-computing infrastructure.
HashiCorp open-source tools:
HashiCorp develops commercial products and open-source tools that allow developers,
operators, and security professionals to provide, secure, run and connect cloud-computing infrastructure.
Why we need Consul Connect?
To understand the consul connect you must be familiar with Microservice architecture,
so In Microservice architecture application, e.g we have several components of an
e-commerce application like User, Payment, Cart, etc and they are developed and deployed
by k8s, so as per the traffic we’re able to scale up and down the deployment and we know
that in Kubernetes we have services which are responsible for the communication.
But How does the payment service know ? where is the user service running ?
because it’s completely decoupled architecture .but applications need to communicate
to other microservices, they need to have information about where the microservices are running.
How do they do that?
Therefore, we need Consul connect, it has to tell the payment service that here is the
URL for the user service and you should talk to that URL to get the user details. and the URL
can be the service name.
but this will work in k8s and container-based deployment, what if you have physical server-based deployment and we have the same problem, how does payment service will connect to user service.
Automatic Service Discovery:
- Service Discovey that allows you to automatically discover all the services, where the request should go and so it keeps the Information about them as a central location so that your microservices can use that information.
- In simple words Automatic Service Discovery allows you to connect to other services whichever node they are running.
Features of Service Discovery:
- Connection
- Secure because SD also enforce that whatever communication is coming from any service is encrypted (TLS)
- Monitor the entire cluster for the service availablity, latency etc which it does by default.
Service Mesh:
- Service Mesh is like framework here that each microservice should be able to talk to other microservice , there shouldn’t be direct coupling , there should be always loose coupling
- so, this architecture is called as Service Mesh.
- So service discovery is required because there is Service Mesh because there are a lot of services are running all over the place so there is a mesh of service there.
However, this Service Discovery problem and its features are solved by many tools like Istio and many other tools but here we’re only gonna talk about how it is done by Consul Connect.
What is the Consul Connect?
Consul Connect is a tool developed by HashiCorp and provides the solution for Service Mesh. because we’ve Service Mesh by deploying various microservices.
Consul Connect is also used for Service Discovery and encryption (TLS), key-value data stored for sharing the data among the services.
How Consul Connect works?
let’s understand how Consul Connect works!
Data Center:
These aren’t traditional Data Centers, In Consul terms, Data Center is a set of servers and clients, and these may be running in the same physical centers, different clusters but they don’t call them clusters instead you can call them “Consul Data Centers”.
Server:
The server contains all the complete information about all the services that are running and the service registry is also there. and there are other replicated servers so whatever data is updated to the central server is also replicated to other servers.
Consul Clients:
- consul clients can talk to the server and get information about which is require. and clients can also talk to each other . so any client/server can talk to any server/client like shown in image , client of data center 1 can talk to client to data center 2 also.
- It can acts as proxy for your application so your application can run behind a client e.g payment and user application. so whenever you want to talk to other service
- Client will identify where to redirect this request from by talking to the server getting the information
- where user service/app is running . similarly user will return back the communication
NOTE:
In the image, user service can be in Datacenter 1 or Data Center 2 so that’s why the 4th step depends on the registry service where the request needs to be redirect and then get back to the payment service.
Conclusion:
In this blog, we’ve learned about Consul Connect, Service Discovery, and Service Mesh, and these all work. later we’ll see how can we install Consul Connect. If you find this blog helpful do share it with your friends.