What is a service mesh?
- Docker & Kubernetes course
- Expert
- Lesson 19/47
- 4 min
Learn that a service mesh provides traffic management.
What is a service mesh?
A service mesh is an infrastructure layer that manages network traffic between services without changing application code. A proxy (sidecar) is placed next to each pod, or node-level proxies are used; all traffic passes through these proxies. That way these features are added centrally:
- Traffic management: canary, retries, timeouts, circuit breaking
- Security: automatic mTLS between services, authorization policies
- Observability: metrics and distributed tracing for every request
api ──► [envoy] ═══ mTLS ═══ [envoy] ──► db
▲ retries, metrics, policyOptions
Common meshes:
- Istio: the most comprehensive; Envoy sidecars or the sidecar-less "ambient" mode.
- Linkerd: lightweight, simple to install; its own proxy written in Rust.
- Cilium Service Mesh: at the kernel level with eBPF, sidecar-less.
istioctl install --set profile=default -y
kubectl get pods -n istio-system
NAME READY STATUS
istiod-7b9c8d6f5-x2k9p 1/1 Running
istio-ingressgateway-5c6d7e8f9-a1b2c 1/1 RunningPractice Install Istio
Write two commands: install Istio with the default profile without asking for confirmation; list the pods in istio-system.
Starter code
# buraya yazSample solution
istioctl install --set profile=default -y
kubectl get pods -n istio-systemExpected output
✔ Istio core installed ✔ Istiod installed ✔ Ingress gateways installed ✔ Installation complete NAME READY STATUS RESTARTS AGE istio-ingressgateway-5c6d7e8f9-a1b2c 1/1 Running 0 40s istiod-7b9c8d6f5-x2k9p 1/1 Running 0 55s
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 What is the main advantage of a service mesh?
- Taking database backups
- Shrinking image size
- Providing retries, mTLS and metrics without coding them into each application separately Correct answer
- Speeding up pods
Explanation: The cost is extra latency and operational complexity.
2 Install Istio with the default profile.
istioctl install --set ____=default -y
istioctl install --set profile=default -y
Explanation: profile is a ready configuration set (default, demo, minimal).
3 Match.
| Term | Meaning |
|---|---|
Istio |
Envoy-based, comprehensive |
Linkerd |
Lightweight mesh |
Cilium |
eBPF-based |
sidecar |
Proxy beside the pod |