Microservices move complexity from inside the application to the network between services. Every call between services now needs answers to the same questions: Is the connection encrypted? How long should we wait? Should we retry? How do we know which service is slow? How do we release a new version to 5% of traffic?
In most organisations, each team answers those questions differently, in different languages and libraries. A service mesh answers them once, in the platform.
How a service mesh works
A service mesh has two parts.
The data plane is a set of lightweight network proxies, usually deployed as a "sidecar" container next to every service instance. All traffic into and out of the service passes through its proxy. Envoy, originally built at Lyft, is the most common data-plane proxy; Linkerd uses its own Rust-based proxy.
The control plane configures all those proxies: it distributes certificates, routing rules and policies, and collects telemetry. Istio consolidated its control plane into a single component, istiod, earlier this year in version 1.5, which made it noticeably simpler to operate.
flowchart TB
CP[Control plane<br/>config, certificates, policy]
subgraph PodA["Pod: orders"]
A[orders app] <--> PA[proxy]
end
subgraph PodB["Pod: payments"]
B[payments app] <--> PB[proxy]
end
PA <-->|mTLS| PB
CP -.-> PA
CP -.-> PBThe application still makes a plain HTTP or gRPC call to payments. The proxy intercepts it, encrypts it, applies retries and timeouts, records metrics and forwards it to the proxy on the other side.
What you get
Mutual TLS by default. Every connection between services is encrypted and both sides are authenticated with certificates the mesh issues and rotates automatically. This is one of the easiest ways to move towards zero trust inside a cluster.
Traffic management. Canary releases, blue-green deployments and traffic mirroring become configuration rather than code:
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: payments
spec:
hosts: [payments]
http:
- route:
- destination: { host: payments, subset: v1 }
weight: 95
- destination: { host: payments, subset: v2 }
weight: 5
retries: { attempts: 3, perTryTimeout: 2s }
timeout: 5sResilience. Timeouts, retries with budgets, circuit breaking and outlier detection, applied consistently across every service.
Uniform observability. Request rate, error rate and latency (the "golden signals") for every service-to-service call, in every language, without adding instrumentation code. Proxies can also propagate trace headers for distributed tracing.
Access policy. Rules like "only the orders service may call payments" enforced at the proxy, based on service identity rather than IP addresses.
What it costs
A mesh is not free:
- Latency. Each call passes through two extra proxies. For most services this is a millisecond or so, but it adds up in deep call chains.
- Resources. A proxy per pod consumes CPU and memory across the whole cluster.
- Operational complexity. Another critical system to install, upgrade, debug and secure. When the mesh misbehaves, everything misbehaves.
- Learning curve. Istio in particular has a large configuration surface.
Istio, Linkerd or something else?
- Istio is the most feature-rich, built on Envoy, with strong traffic management and policy features. It suits large platforms that need that power and have the team to run it.
- Linkerd focuses on simplicity and low overhead, with automatic mTLS and excellent defaults. It suits teams that mainly want security and observability with minimal configuration.
- Consul Connect fits organisations already using HashiCorp Consul, including outside Kubernetes.
The Service Mesh Interface (SMI) specification aims to provide a common API across meshes, although most teams still use each mesh's own configuration.
When to adopt a mesh
A mesh is worth considering when:
- you run many services (roughly a dozen or more) in several languages,
- you need encryption and authentication between services, for example for compliance,
- teams are re-implementing retries, timeouts and metrics inconsistently, or
- you want progressive delivery (canaries) as a platform capability.
It is probably premature if you have a handful of services, a single language (where a shared library may be enough), or no one who can own the mesh as a platform component.
A sensible adoption path
- Start in a non-production cluster and enable the mesh for a few services.
- Turn on mTLS in permissive mode, then strict once all services are in the mesh.
- Use the telemetry first. It is often the most immediately useful feature.
- Add traffic policies (timeouts, retries, canaries) gradually, service by service.
- Treat mesh upgrades as a regular, planned activity.
The bottom line
A service mesh does not remove the complexity of microservices, but it puts much of it in one place, managed by a platform team instead of every application team. For large microservice estates, that is a good trade. For small ones, a well-chosen library and good defaults may be all you need.
Our secure SDLC team designs and operates cloud-native platforms, including service meshes, and our network penetration testing covers east-west traffic inside clusters.