Course: Cloud Computing Technologies
Authors: Fulvio Risso, Stefano Galantino, Politecnico di Torino
Source: Service Mesh and Istio, 36 PDF pages (printed slides 1, 3–17, and 19–38; printed numbers 2 and 18 are absent).
Lecture numbering: 13 records its position in the course sequence after Lecture 12. The source was supplied in the study session and remains outside the published resources.
Learning route
Lecture 11 showed how Kubernetes schedules and exposes containers, and Lecture 12 noted that advanced deployment strategies such as A/B Testing and Shadow deployments require a Service Mesh. This lecture explains why Kubernetes alone is insufficient for East-West microservice communication, how a Service Mesh works under the hood with Envoy and Istio, and why Istio evolved from Sidecar Mode to Ambient Mode. Part I (PDF pp. 2–16) motivates service meshes via circuit breaking, dynamic routing, and a 3-way comparison against embedded libraries and central API gateways. Part II (PDF pp. 17–33) examines Envoy, Control Plane vs. Data Plane separation, iptables traffic stealing, and Sidecar vs. Ambient Mode (ztunnel + waypoint + istio-cni). Part III (PDF pp. 34–36) introduces Istio’s five traffic management YAML resources (VirtualService, DestinationRule, Gateway, ServiceEntry, Sidecar).
Exam priorities
Focus on: why Kubernetes’ DNS + L3/4 load balancing is insufficient; Circuit Breaking vs. Kubernetes /health checks; comparing the 3 architectures (Embedded Libraries vs. Central API Gateway’s 8-hop East-West bottleneck vs. Service Mesh’s direct proxy-to-proxy hops); Data Plane vs. Control Plane separation (and what happens if the Control Plane crashes); the 6-step iptables sidecar interception trace (and why loopback avoids an infinite loop on veth); Sidecar Mode limitations vs. Ambient Mode (“slicing the layers” into L4 ztunnel + opt-in L7 waypoint proxies + istio-cni); and distinguishing Istio’s VirtualService, DestinationRule, and Gateway resources in YAML. Background slides on SOA vs. developer-driven microservices and the out-of-scope software catalog are familiarity/context.
Part I: Why We Need a Service Mesh (Libraries vs. API Gateway vs. Mesh)
Kubernetes provides deployment orchestration, DNS service discovery, and simple L3/4 load balancing, which leaves developers without L7 routing, identity-based security, fault tolerance, or distributed observability across hundreds of services. As monoliths split into developer-driven microservices (“clone and evolve”), teams need circuit breakers (which monitor live traffic to stop cascading failures that simple Kubernetes URL health checks miss) and dynamic request routing (e.g., splitting 80% of traffic to Service B v1 Prod and 20% to v2 Stag).
Embedding these features as code libraries inside every microservice bloats services, requires recompilation, and breaks consistency across programming languages. Routing all calls through a single central API Gateway works well for North-South edge traffic, but turns every internal East-West interaction (Client -> GW -> A -> GW -> B -> ..., 8 hops) into a central bottleneck. A Service Mesh solves this by placing lightweight proxies beside services (or nodes) for direct East-West proxy-to-proxy communication, while a global controller pushes uniform policies out of the request path. Service Mesh Motivation - Libraries API Gateway and Circuit Breaking
Part II: Envoy, iptables Interception, and Sidecar vs. Ambient Mode
Envoy (written in C++) serves as Istio’s high-performance data-plane proxy, providing dynamic discovery, load balancing, HTTP/2 & gRPC multiplexing, circuit breaking, %-based traffic splits (e.g., 10% v2 / 90% v1), and rich Prometheus/Datadog metrics. Istio acts as the Control Plane, translating Kubernetes YAML (kubectl / istioctl) into configurations for the Data Plane proxies without ever sitting in the path of live user requests.
In Sidecar Mode (2017), Kubernetes MutatingWebhooks automatically inject an Envoy container into every Pod. Inside the Pod’s shared Linux network namespace, iptables rules transparently intercept inbound packets on veth (port X1 -> Envoy X2 -> loopback:X1 -> App 1) and outbound replies (App 1 -> iptables -> Envoy X3 -> veth). However, Sidecar Mode suffers from invasiveness (Pod restarts to install/upgrade Envoy), resource underutilization (worst-case reservations per Pod), and traffic breaking on non-conformant HTTP. Ambient Mode (2022 / Istio 1.22+) eliminates sidecars by slicing the layers: a shared per-node ztunnel handles always-needed L4 mTLS (istio-cni writes iptables rules and ztunnel opens sockets directly in the Pod’s network namespace), while optional per-namespace Envoy waypoint proxies handle L7 features only where opted in. Envoy Proxy and Istio Sidecar vs Ambient Mode
Part III: Istio Traffic Management Resources
Istio exposes five declarative resources to govern mesh behavior: VirtualService (ordered L7 routing rules, e.g., sending end-user: jason to reviews subset: v2 and everyone else to v3), DestinationRule (post-routing policies such as load balancing, circuit breaking, and subset definitions), Gateway (inbound/outbound North-South rules bound to standalone edge Envoy proxies, such as TLS termination on port 443 for ext-host.example.com), ServiceEntry (registering external dependencies outside the cluster), and Sidecar (limiting Envoy scope for namespace isolation). Istio Traffic Management - VirtualServices DestinationRules and Gateways
Source map
| PDF pages | Printed slides | Topic |
|---|---|---|
| 1 | 1 | Title (Service Mesh and Istio, Fulvio Risso & Stefano Galantino, Politecnico di Torino) |
| 2 | 3 | Kubernetes networking limits (DNS discovery, simple L3/4 LB) |
| 3–7 | 4–8 | Embedded libraries vs. microservices, SOA vs. developer-driven growth, catalog note, Amazon/Netflix dependency graphs |
| 8–9 | 9–10 | Circuit breaking (vs. K8s health checks) & Dynamic request routing (80%/20% v1/v2 diagram) |
| 10–16 | 11–17 | Additional common functions & 3 solutions compared: #1 Embedded libraries, #2 API Gateway (8-hop trace), #3 Service Mesh (global controller + sidecar trace) |
| 17–22 | 19–24 | Envoy proxy capabilities (dynamic discovery, LB, HTTP/2 & gRPC, circuit breakers, %-based split, Prometheus/Datadog metrics) |
| 23–24 | 25–26 | Service communication with vs. without Envoy; Istio Control Plane managing a fleet of Envoys via YAML (kubectl/istioctl) |
| 25 | 27 | Stealing traffic with the sidecar approach: 6-step transparent TCP proxy & iptables redirection inside Pod network namespace |
| 26–29 | 28–31 | Istio overview & 5 pillars, Data Plane vs. Control Plane, Sidecar Mode (MutatingWebhooks), and 3 Sidecar limitations |
| 30–33 | 32–35 | Ambient Mode (2022 / Istio 1.22): slicing L4 Secure Overlay vs. L7 Processing, ztunnel + waypoint proxies, and istio-cni in-pod networking |
| 34–36 | 36–38 | Istio Traffic Management: 5 resources overview, VirtualService (reviews / jason) YAML, and Gateway (ext-host-gwy) YAML |
Retrieval questions
- Why is a central API Gateway suitable for North-South edge traffic but a poor fit for East-West microservice communication?
A central API Gateway forces every internal microservice-to-microservice hop through one central node (e.g., 8 hops forClient -> A -> B), creating a scaling bottleneck and requiring gateway updates whenever services change, whereas a Service Mesh lets sidecars/node proxies communicate directly. - How does a Circuit Breaker detect failures that Kubernetes’ built-in
/healthcheck misses?
Kubernetes probes check a simple URL like/healththat may still return200 OKquickly even when complex requests hang or time out; a circuit breaker monitors real live traffic calls and trips once errors/timeouts cross a threshold, failing fast without calling the broken service. - Trace how
iptablesredirects incoming traffic inside a Sidecar Pod without Application 1 knowing Envoy exists, and explain whyloopbackis used.
iptablesintercepts inbound packets arriving onvethfor App 1’s portX1and redirects them to Envoy (X2); Envoy inspects the request and sends it overloopback(localhost:X1) to App 1, avoidingvethso the packet does not re-trigger theiptablesrule in a loop. - Why did Istio introduce Ambient Mode, and how do
ztunnel,istio-cni, andwaypointproxies divide the work?
Sidecar Mode is all-or-nothing (wasting per-Pod worst-case resources, breaking non-conformant HTTP, and requiring Pod restarts to upgrade Envoy). Ambient Mode splits L4 and L7:istio-cniconfigures Podiptablesrules so a shared per-nodeztunnelopens local sockets and provides always-on L4 mTLS, while opt-in per-namespace Envoywaypointproxies handle L7 features. - Contrast
VirtualService,DestinationRule, andGatewayin Istio.
VirtualServicedefines ordered L7 routing rules (which destination/subset receives a request),DestinationRulesets post-routing policies (load balancing, circuit breaking, subsets), andGatewayconfigures standalone edge Envoy proxies for North-South ingress/egress ports, hosts, and TLS.
Related
- Lecture 10 - Microservices and Containers Orchestration
- Lecture 11 - Kubernetes
- Lecture 12 - Cloud Native Applications and the 12-Factor App
- Service Mesh Motivation - Libraries API Gateway and Circuit Breaking
- Envoy Proxy and Istio Sidecar vs Ambient Mode
- Istio Traffic Management - VirtualServices DestinationRules and Gateways