Service Mesh: Why is it necessary?
The challenges involved in deploying and managing microservices have led to the creation of the service mesh, a tool for adding observability, security, and traffic management capabilities at the application layer. While a service mesh is intended to help developers with several use cases related to service-to-service communication within Kubernetes clusters, a service mesh also adds operational complexity and introduces an additional control plane for security teams to manage.
What is a Service Mesh?
A service mesh is a dedicated infrastructure layer built into an application that controls service-to-service communication in a microservices architecture. It controls the delivery of service requests to other services, performs load balancing, encrypts data, and discovers other services. Although you can code the logic that governs communication directly into the microservices, a service mesh abstracts that logic into a parallel layer of infrastructure using a proxy called a sidecar, which runs alongside each service. Sidecar proxies make up a service mesh’s data plane, which manages the exchange of data between services. Management processes make up the control plane, which coordinates the proxies’ behavior. The control plane also provides an API so operators can easily manage traffic control, network resiliency, security and authentication, and custom telemetry data for each service.
Why would an organization need it?
Using a service mesh, which is a configurable, low-latency infrastructure layer in software, is still a fairly new approach. It was born out of the need for organizations to effectively manage the rapidly growing number of microservices they are developing as they build applications.
For example, an e-commerce application app that typically has microservices architecture, with front-end and back-end components, needs services to communicate securely to support customer transactions. Such apps can include shopping carts and shipping services.
It can bind all the services in a Kubernetes cluster together so they can communicate with each other. It enables secure, service-to-service communication by creating a Transport Layer Security (TLS)-encrypted gateway. Service mesh features include traffic management, observability, and security.
How does a Service Mesh work?
A service mesh works through discovery and routing applications that are installed on every VM instance or node in an elastic web server network to register running microservices by IP address. A central registry is used for configuring, managing, and administering all of the microservices that run simultaneously on a network. It can be referenced by parallel applications operating at the various layers of a web server, data center, or application to extend interoperable functionality through data analytics and network monitoring. This leads to increased data center automation at the level of IP routing, SDN definitions, firewall settings, filters, rules, and cloud load balancing.
API connections can reference the service mesh for definitions of where to discover running applications and microservice features for data transfers or required processing activity. Elastic web server platforms that scale automatically with Kubernetes use Istio as the central registry and configuration management utility for microservice discovery. Elastic web server platforms like AWS EC2 and Kubernetes utilize the service mesh for managing multiple copies of cloud applications in simultaneous runtimes while synchronizing changes to the master database and storage information. A service mesh permits the application layer to communicate with the web server, internet, and data center network resources through APIs, or vice versa, depending on the microservice or code requirements.
Key Features of a Service Mesh
Its framework typically provides many capabilities that make containerized and microservices communications more reliable, secure, and observable.
- Reliability. Managing communications through sidecar proxies and the control plane improves the efficiency and reliability of service requests, policies, and configurations. Specific capabilities include load balancing and fault injection.
- Observability. Its frameworks can provide insights into the behavior and health of services. The control plane can collect and aggregate telemetry data from component interactions to determine service health, such as traffic and latency, distributed tracing, and access logs. Third-party integration with tools, such as Prometheus, Elasticsearch, and Grafana, enables further monitoring and visualization.
- Security. It can automatically encrypt communications and distribute security policies, including authentication and authorization, from the network to the application and individual microservices. Centrally managing security policies through the control plane and sidecar proxies helps keep up with increasingly complex connections within and between distributed applications.
Benefits and Drawbacks
The advantages of service meshes are:
- Service-to-service communication is simplified both for containers and microservices.
- Communication errors are easier to diagnose because they occur within their own infrastructure layer.
- You can develop, test, and deploy applications faster.
- Sidecars placed alongside container clusters can effectively manage network services.
- It supports various security features, including encryption, authentication, and authorization.
Some of the drawbacks are:
- The use of a service mesh can increase runtime instances.
- Communication involves an additional step—the service call first has to run through a sidecar proxy.
- It doesn’t support integration with other systems or services
- They don’t address issues such as transformation mapping or routing type.
Service Mesh challenges
The two main challenges posed by service mesh are complexity and performance. In terms of complexity, it is difficult to set up and manage. It requires specialized skills and includes capabilities that most users don’t need. Because service mesh introduces latency, it can also create performance issues.
Many of the challenges associated with service mesh stem from the fact that there is so much to configure (the majority of the features mentioned above require some form of configuration). While there are many service meshes out there, there’s no one-size-fits-all solution when it comes to the needs of different organizations. Security teams will likely need to spend a good amount of time figuring out which service mesh will work for their applications.
As such, the use of a service mesh requires the development of domain knowledge and specialized skills around whichever service mesh you end up choosing. That adds another layer of complexity in addition to the work you’re already doing with Kubernetes.
Conclusion
Service mesh is not an optional feature for consideration for organizations using a microservice architecture. It provides critical observability, reliability, and security features. As this runs on a platform level, it is not a burden on the core business application. It is a dominant feature that alleviates the developer’s crucial time so that they can focus on value-added activities.