In a project environment with numerous services or applications that need to be registered and stored in data centers, it’s always essential to constantly track the status of these services to be sure they are working correctly and to send timely notifications if there are any problems. A tool we use for this is Consul.
HashiCorp provides open source tools and commercial products to provision, secure, and run distributed application infrastructure. They make Consul, which serves as a DevOps tool that provides service discovery, health checks, load balancing, and key/value storage. It’s open source, but it’s also available in a paid enterprise version.
A DevOps team will usually choose a Consul cluster (also known as a high-availability cluster), consisting of one or more servers and agents. Servers are used for information storage, while agents installed on nodes (virtual machines, cloud, data centers, or on-premise machines) transmit all the data concerning services to a server providing data synchronization. Moreover, agents can make deployment and service updates with new versions.
Consul helps to store data in the simplest and most convenient way, serving as a key/value store and providing service discovery. It is also worth mentioning that agents can be configured manually or automatically. If an agent is configured manually, the agent is installed on each node. Then, a JSON file using Consul syntax is added with a task entered in a terminal window. This triggers the reading of the file and scanning the directory where the configuration files with the services are stored. This ensures that services are registered on the server.
If Consul agents on the nodes do not have any deployed services, Kubernetes or Docker is used to scale services that are in containers, providing automation of the service registration on the server. The server destination is then determined with the help of agents.
Exadel and Consul in Action: A Story from One of Our Engagements
While working with a client at Exadel, a DevOps team needed to provide integration between Consul and Kubernetes in an environment in which all of the automation was built in Kubernetes and Ansible. There were four virtual machines on the Kubernetes cluster. Using Ansible, the team deployed a Consul cluster to these machines with one server and three agents. Once the team entered the Consul UI through a browser, they could see a tab with the three nodes (IPs of the virtual machines) complete with their DNS names.
We deployed an application for the client using Ansible and Kubernetes. In the annotations section they stated that it needed to be included again in the Consul cluster. Then the application was deployed to the nodes, synchronized, and registered in Consul. Now when they enter the Consul UI, they can see both node and service (application) tabs.
In the Services tab, they can see exact services where health checks are identified to make sure that the service works appropriately. Overall, using Consul allowed the team to monitor and check the entire system with great ease.
Business Value of Consul
- Better visualization of services including the ability to make well-structured reports with all the information about the services including what services exist, how many problems occurred with the various services, etc.
- Saving development costs through health checks that zero in on problems quickly without wasting developers’ time (additional savings come from not needing additional monitoring systems like Zabbix and Nagios)
- Saving development costs on designing and implementing microservice architectures through speeding up the process of identifying errors among the different services to be integrated in such architectures
- Improved security through the Consul Service Mesh, which encrypts traffic among agents and nodes, and through configuring access control lists that regulate communication between applications.
If you want to learn more about Exadel Digital Transformation Practice and the challenges it may solve, check out the website, or get in touch with the Digital Transformation team to speak with our experts.