GKE Service Mesh — Cloud Service Mesh (Managed Istio)
Tại sao quan trọng?
Service mesh giải quyết vấn đề cross-cutting concerns trong kiến trúc microservices mà application code không nên biết đến: mTLS, retry, circuit breaking, distributed tracing, traffic shaping. Nhưng đây cũng là một lớp abstraction phức tạp — khi Envoy proxy gây latency cao, khi mTLS handshake fail, khi VirtualService không route đúng, bạn cần hiểu cơ chế bên dưới để debug hiệu quả.
Cloud Service Mesh (CSM) là managed Istio/Envoy của Google trên GKE. Nó loại bỏ toil của việc tự cài Istio, nhưng vẫn expose toàn bộ API Istio. Hiểu Envoy xDS API, sidecar injection mechanics, SPIFFE/SVID certificate lifecycle — đây là những kiến thức giúp bạn debug production issues và optimize performance trong vài phút thay vì vài giờ.
Điều kiện tiên quyết
- GKE Networking Internals — eBPF, iptables, VPC-native, packet paths
- GKE Ingress & Gateway API — L7 load balancing, NEGs, Gateway API
- Microservices architecture fundamentals — service-to-service communication patterns
Phạm vi chương này
Chapter này tập trung vào production operations của Cloud Service Mesh:
- Kiến trúc CSM — Managed Istio/Envoy, control plane vs data plane, Istiod
- Sidecar Injection — Automatic injection, init container iptables rules, traffic interception
- mTLS & SPIFFE/SVID — Certificate lifecycle, PERMISSIVE vs STRICT mode, debugging
- Traffic Management — VirtualService, DestinationRule, Gateway, circuit breaking, retries
- Envoy xDS API — CDS/EDS/LDS/RDS/SDS — cách Istiod push config xuống Envoy
- Observability & Tracing — Metrics, access logs, distributed tracing, CSM dashboard
- Sidecar Performance — Resource overhead, latency impact, tuning strategies
Subtopics
Kiến Trúc CSM — Managed Istio, Data Plane vs Control Plane — Cloud Service Mesh lifecycle, Istiod components, Envoy sidecar role, GKE integration model, so sánh self-managed Istio vs CSM
Sidecar Injection — Init Container, iptables Interception — Webhook injection mechanics, init container iptables REDIRECT rules, traffic interception path, troubleshooting injection failures, opting out
mTLS & SPIFFE/SVID — Zero-Trust Service Identity — SPIFFE/SVID identity model, certificate issuance từ Istiod CA, PERMISSIVE vs STRICT PeerAuthentication, mTLS handshake lifecycle, debugging cert failures
Traffic Management — VirtualService, DestinationRule, Circuit Breaking — Istio traffic management API, weighted routing, canary deployment, retry/timeout policies, circuit breaker pattern với Envoy outlier detection
Envoy xDS API — Cách Istiod Push Config — xDS protocol (CDS/EDS/LDS/RDS/SDS), push vs pull model, config reconciliation, debugging với
istioctl proxy-config, config versioningObservability & Distributed Tracing — Istio metrics (RED signals), Envoy access logs, trace header propagation, sampling strategies, CSM dashboard SLOs, topology view
Sidecar Performance — Overhead, Latency, Resource Tuning — CPU/memory overhead đo thực tế, latency per-hop, concurrency tuning, resource request/limit guidelines, khi nào dùng sidecarless (ambient mesh)
Mental Model
┌─────────────────────────────────────┐
│ CONTROL PLANE │
│ Istiod (Pilot + Citadel + Galley) │
│ - Service discovery (EDS) │
│ - Config distribution (xDS) │
│ - Certificate issuance (SDS) │
└──────────────────┬──────────────────┘
│ xDS (gRPC streaming)
┌──────────────────▼──────────────────┐
│ DATA PLANE │
│ │
│ [Pod A] [Pod B] │
│ app | envoy ──▶ envoy | app │
│ (sidecar) (sidecar) │
│ │
│ mTLS tunnel, traffic policies, │
│ telemetry collection │
└─────────────────────────────────────┘Mọi traffic giữa Pod A và Pod B đều đi qua Envoy sidecar. Application code không cần biết về mTLS, retry, circuit breaking — đây là responsibility của Envoy được configured bởi Istiod.
Key Production Trade-offs
| Trade-off | Lựa chọn |
|---|---|
| mTLS PERMISSIVE vs STRICT | STRICT là target production; PERMISSIVE trong migration period |
| Sidecar vs sidecarless (ambient) | Sidecar rõ ràng hơn, ambient tiết kiệm resource nhưng experimental |
| Managed CSM vs self-hosted Istio | CSM cho GKE; self-hosted nếu cần customization sâu |
| Retry aggressive vs conservative | Conservative (2 retries, idempotent endpoints only) để tránh retry storm |