Service Mesh

A service mesh is an infrastructure layer that handles service-to-service communication — encryption, retries, timeouts, load balancing, traffic routing, and telemetry — outside your application code. Instead of every service implementing mTLS and retry logic in its own language and library, the mesh intercepts all traffic between services and applies these policies uniformly.

It solves a real problem of microservice sprawl: fifty services in five languages each doing (or forgetting) their own TLS, retries, and metrics. The trade is operational complexity — a mesh is a significant piece of infrastructure — which is why the honest guidance runs both ways: transformative for large platform teams, overkill for a handful of services.

TL;DR

How It Works

The application makes a plain HTTP call to payment:8080; the local proxy transparently intercepts it, wraps it in mTLS with the service's cryptographic identity, applies retry/timeout policy, records metrics, and delivers it to the destination's proxy. The app neither knows nor cares — which is the point: the network becomes smart so the services can stay dumb.

Sidecar vs sidecar-less: the per-pod Envoy sidecar (classic Istio) is battle-tested but costs memory/latency per pod and complicates upgrades. The field has moved toward lighter data planes: Linkerd's purpose-built Rust micro-proxy, Istio ambient mode (shared per-node L4 proxy + optional L7 waypoints), and Cilium mesh (eBPF in the kernel, no proxy for much of the path). New adopters should evaluate the sidecar-less modes first.

Quick Example

Istio traffic policy — a 90/10 canary plus retries, no application changes:

And mesh-wide strict mTLS in one resource:

What a Mesh Buys You

Zero-Trust Security (mTLS + Policy)

Every workload gets a short-lived cryptographic identity (SPIFFE-style); every hop is encrypted and mutually authenticated; certificates rotate automatically. On top of identity, authorization policies say which service may call which:

"Only the orders service may POST /charge" — enforced in the network, not trusted to app code. This is the practical implementation of zero-trust east–west networking, and for many regulated shops the entire business case.

Resilience Without Libraries

Timeouts, retries with budgets, and circuit breaking (outlier ejection) applied uniformly — the Hystrix-style resilience layer, moved out of per-language libraries into infrastructure. One caution: retries multiply load during incidents; set retry budgets and make sure retried operations are idempotent.

Traffic Management

Weighted shifting (canary), header-based routing (internal users to v2), mirroring (shadow production traffic to a new version), and fault injection (deliberately add latency/errors to test resilience). Paired with a progressive-delivery tool (Argo Rollouts, Flagger) analyzing metrics, canaries promote or roll back automatically — see Deployment Strategies.

Uniform Observability

Every proxy emits the same golden-signal metrics (rate, errors, latency per service pair), feeds Prometheus/Grafana service dashboards, and propagates tracing headers. You get a live service dependency map without instrumenting a line of code — though apps must still forward trace context headers for traces to join across hops.

Choosing (and Whether to Choose)

Do you need one at all? A decent decision test:

Common Mistakes

Adopting the Mesh Before the Need

Istio on eight services adds a control plane, proxy fleet, and new failure modes to solve problems a shared library and cert-manager already solve. Meshes pay off at scale and heterogeneity — adopt at the pain point, not the conference talk.

Nobody Owns It

A mesh is a product your platform team operates: upgrades (control plane and data plane, carefully ordered), certificate authority health, proxy resource tuning. Meshes installed by a departed enthusiast are how clusters end up three major versions behind on a security-critical component.

Permissive mTLS Forever

Meshes roll out in permissive mode (plaintext still accepted) for migration. Teams forget to flip to STRICT — leaving the security story half-true. Track it; the whole point was the lock.

Retry Storms

Mesh retries × app retries × client retries turn one slow dependency into a self-inflicted DDoS. Configure retries at one layer, with budgets, on idempotent routes only.

Debugging Blind

"Is it the app or the mesh?" is the new "is it DNS?". Invest in the mesh's own debugging tools (istioctl analyze, proxy config dumps, access logs) before the incident, and include proxy logs in your log aggregation.

FAQ

Service mesh vs API gateway?

Direction of traffic: the gateway handles north–south (external clients entering the system — auth, quotas, developer-facing concerns); the mesh handles east–west (service-to-service — mTLS, retries, internal routing). Mature platforms run both, often with the mesh's ingress gateway as the entry point behind the API gateway.

Does a mesh replace Kubernetes Services and Ingress?

No — it layers on them. Kubernetes Services still provide discovery/DNS; the mesh's proxies take over the actual load balancing and add policy. Ingress remains (or is replaced by the mesh's gateway implementation of the Gateway API).

How much overhead does a sidecar add?

Classically ~50–100 MB memory per pod and roughly 1–3 ms added latency per hop for Envoy sidecars (Linkerd's micro-proxy is lighter). Ambient and eBPF approaches cut most of the per-pod cost — a main reason the ecosystem moved that way. Benchmark on your own p99s, not vendor slides.

Can I get mTLS without a whole mesh?

Partially: cert-manager + app-level TLS works but pushes cert handling into every service; Cilium can do transparent encryption (WireGuard/IPsec) at the network layer without workload identity. What the mesh uniquely adds is identity-based policy ("orders may call payment") with automatic rotation.

Do meshes work outside Kubernetes?

Consul Connect and Istio's VM integration extend meshes to VMs, and that matters in hybrid migrations — but the ergonomics, docs, and community assume Kubernetes. Off-cluster-first environments usually get more value from an API gateway plus network-level encryption.

Related Topics

References