Service Mesh with Istio
Add mutual TLS, traffic management, and deep observability to service-to-service communication without changing application code.
The Problem: Distributed Systems Complexity
As a system grows from a monolith to microservices, new problems emerge:
- Security: How do you ensure every service-to-service call is encrypted and authenticated?
- Reliability: How do you add retries, circuit breakers, and timeouts without rewriting every service?
- Observability: How do you get request traces across 20 services without adding tracing SDK to each?
A service mesh solves all three by moving this logic out of the application into the network layer.
How a Service Mesh Works: The Sidecar Pattern
Istio injects an Envoy proxy sidecar into every Pod (automatically via MutatingAdmissionWebhook). The sidecar intercepts ALL inbound and outbound traffic using iptables rules β the application process is unaware.
WITHOUT ISTIO WITH ISTIO
βββββββββββββββββββββ ββββββββββββββββββββββββββββββββββ
Pod A (app container) Pod A
β plain HTTP β app container
βΌ β envoy sidecar β intercepts traffic
Pod B (app container) β (mTLS, retries, metrics)
βΌ
Pod B
β envoy sidecar β mutual TLS
β app containerCore Istio Components
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CONTROL PLANE β
β β
β istiod (Pilot + Citadel + Galley merged) β
β βββ Pilot: distributes routing config to sidecars β
β βββ Citadel: Certificate Authority (issues mTLS certs) β
β βββ Galley: validates Istio config resources β
βββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββ
β xDS API (gRPC streaming)
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DATA PLANE (every pod) β
β ββββββββββββββββββββββββββββββββββββββββ β
β β Pod β β
β β βββββββββββββ βββββββββββββββββ β β
β β β App ββββββ Envoy Sidecar β β β
β β β Container ββββββ (istio-proxy) β β β
β β βββββββββββββ βββββββββββββββββ β β
β β Handles: β β
β β β’ mTLS termination β β
β β β’ retries/timeouts β β
β β β’ metrics/traces β β
β ββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββMutual TLS (mTLS)
Istio's Citadel component acts as a Certificate Authority. It issues short-lived X.509 certificates to every sidecar based on the Pod's ServiceAccount (SPIFFE identity: spiffe://cluster.local/ns/default/sa/web-sa).
- Strict mode β sidecars only accept mTLS connections; plain HTTP is rejected
- Permissive mode β sidecars accept both mTLS and plain HTTP (migration mode)
apiVersion: security.istio.io/v1beta1
kind: PeerAuthentication
metadata:
name: default
namespace: production
spec:
mtls:
mode: STRICT # Reject all non-mTLS connections in this namespaceTraffic Management
Istio's VirtualService and DestinationRule resources control how traffic is routed between services β independently of Kubernetes Services:
# Canary deploy: send 10% of traffic to v2
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: web
spec:
hosts: [web]
http:
- route:
- destination:
host: web
subset: v1
weight: 90
- destination:
host: web
subset: v2
weight: 10Observability: The Golden Signals
Because all traffic passes through Envoy sidecars, Istio automatically collects:
- Metrics β request rate, error rate, latency (exported to Prometheus)
- Traces β distributed traces across all hops (via Jaeger/Zipkin via B3/W3C headers)
- Access logs β every request/response with full metadata
This observability is zero-code β no SDK changes required in any application.