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 pagesPrinted slidesTopic
11Title (Service Mesh and Istio, Fulvio Risso & Stefano Galantino, Politecnico di Torino)
23Kubernetes networking limits (DNS discovery, simple L3/4 LB)
3–74–8Embedded libraries vs. microservices, SOA vs. developer-driven growth, catalog note, Amazon/Netflix dependency graphs
8–99–10Circuit breaking (vs. K8s health checks) & Dynamic request routing (80%/20% v1/v2 diagram)
10–1611–17Additional common functions & 3 solutions compared: #1 Embedded libraries, #2 API Gateway (8-hop trace), #3 Service Mesh (global controller + sidecar trace)
17–2219–24Envoy proxy capabilities (dynamic discovery, LB, HTTP/2 & gRPC, circuit breakers, %-based split, Prometheus/Datadog metrics)
23–2425–26Service communication with vs. without Envoy; Istio Control Plane managing a fleet of Envoys via YAML (kubectl/istioctl)
2527Stealing traffic with the sidecar approach: 6-step transparent TCP proxy & iptables redirection inside Pod network namespace
26–2928–31Istio overview & 5 pillars, Data Plane vs. Control Plane, Sidecar Mode (MutatingWebhooks), and 3 Sidecar limitations
30–3332–35Ambient Mode (2022 / Istio 1.22): slicing L4 Secure Overlay vs. L7 Processing, ztunnel + waypoint proxies, and istio-cni in-pod networking
34–3636–38Istio Traffic Management: 5 resources overview, VirtualService (reviews / jason) YAML, and Gateway (ext-host-gwy) YAML

Retrieval questions

  1. 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 for Client -> A -> B), creating a scaling bottleneck and requiring gateway updates whenever services change, whereas a Service Mesh lets sidecars/node proxies communicate directly.
  2. How does a Circuit Breaker detect failures that Kubernetes’ built-in /health check misses?
    Kubernetes probes check a simple URL like /health that may still return 200 OK quickly 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.
  3. Trace how iptables redirects incoming traffic inside a Sidecar Pod without Application 1 knowing Envoy exists, and explain why loopback is used.
    iptables intercepts inbound packets arriving on veth for App 1’s port X1 and redirects them to Envoy (X2); Envoy inspects the request and sends it over loopback (localhost:X1) to App 1, avoiding veth so the packet does not re-trigger the iptables rule in a loop.
  4. Why did Istio introduce Ambient Mode, and how do ztunnel, istio-cni, and waypoint proxies 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-cni configures Pod iptables rules so a shared per-node ztunnel opens local sockets and provides always-on L4 mTLS, while opt-in per-namespace Envoy waypoint proxies handle L7 features.
  5. Contrast VirtualService, DestinationRule, and Gateway in Istio.
    VirtualService defines ordered L7 routing rules (which destination/subset receives a request), DestinationRule sets post-routing policies (load balancing, circuit breaking, subsets), and Gateway configures standalone edge Envoy proxies for North-South ingress/egress ports, hosts, and TLS.