Skip to content

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

Phạm vi chương này

Chapter này tập trung vào production operations của Cloud Service Mesh:

  1. Kiến trúc CSM — Managed Istio/Envoy, control plane vs data plane, Istiod
  2. Sidecar Injection — Automatic injection, init container iptables rules, traffic interception
  3. mTLS & SPIFFE/SVID — Certificate lifecycle, PERMISSIVE vs STRICT mode, debugging
  4. Traffic Management — VirtualService, DestinationRule, Gateway, circuit breaking, retries
  5. Envoy xDS API — CDS/EDS/LDS/RDS/SDS — cách Istiod push config xuống Envoy
  6. Observability & Tracing — Metrics, access logs, distributed tracing, CSM dashboard
  7. Sidecar Performance — Resource overhead, latency impact, tuning strategies

Subtopics

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-offLựa chọn
mTLS PERMISSIVE vs STRICTSTRICT 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 IstioCSM cho GKE; self-hosted nếu cần customization sâu
Retry aggressive vs conservativeConservative (2 retries, idempotent endpoints only) để tránh retry storm

Tham khảo nhanh