Service Mesh
In one line
A service mesh manages inter-service communication — traffic routing, retries, encryption, and monitoring without code changes.
In simple words
A service mesh controls how microservices communicate. It handles traffic routing, load balancing, retries, circuit breaking, encryption (mTLS), and observability — all without changing application code.
How it works: Each service gets a sidecar proxy (Envoy). All traffic goes through the proxy. The control plane (Istio) configures all proxies.
Popular: Istio, Linkerd. Trade-off: added complexity and latency vs powerful features without code changes.
Example
# Istio: route 90% to v1, 10% to v2 (canary)
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
spec:
http:
- route:
- destination: { host: my-app, subset: v1 }
weight: 90
- destination: { host: my-app, subset: v2 }
weight: 10Istio routes 90% to v1 and 10% to v2 (canary). mTLS, retries, and circuit breaking configured in YAML — no code changes.
Common confusions
Confused with: API Gateway
The difference: API gateway handles external traffic (north-south). Service mesh handles internal traffic (east-west). API gateway is for external clients; service mesh is for internal services.
Related terms
Related Resources
Related Lessons
- Service Mesh
Service mesh.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.