Chương 48: Multi-Cluster Architecture & Networking trong GKE
Tại sao điều này quan trọng
Multi-cluster là mô hình chuẩn cho production GKE deployments. Nhưng networking giữa các clusters không phải bước mở rộng tầm thường của single-cluster networking — nó yêu cầu một bộ nguyên tắc riêng biệt về service discovery, traffic routing, identity, và isolation.
Những thách thức chính:
- Service discovery xuyên cluster: làm sao một pod trong cluster A biết cách gửi request tới service trong cluster B?
- Identity federation: làm sao Workload Identity hoạt động khi một workload chạy trên các clusters khác nhau nhưng cùng một project?
- Traffic routing global: làm sao một global load balancer biết chọn endpoint tối ưu từ nhiều clusters?
- Network isolation: làm sao các cluster duy trì cô lập network nhưng vẫn có thể giao tiếp an toàn?
- DNS consistency: làm sao DNS peering hoạt động khi mỗi cluster có DNS zone riêng?
Nếu bạn thiết kế multi-cluster mà không hiểu cơ chế này, bạn sẽ gặp phải: latency không giải thích được, flapping cross-cluster connections, security gaps bị phát hiện muộn, và operational toil khi debug isolation issues.
Mục tiêu học tập
Sau chương này, bạn sẽ:
- Hiểu mental model của multi-cluster networking: service discovery (ServiceImport/Export), traffic routing (MCI), identity federation
- Thiết kế architecture đa cụm: lựa chọn use case (HA/DR/geo-distribution), network topology (VPC peering), identity model
- Triển khai production patterns: MCS + MCI stack, service mesh trust federation, DNS peering
- Vận hành và debug: trace request xuyên clusters, diagnose identity issues, verify network paths
Điều kiện tiên quyết
- Chương 5–18: GKE fundamentals, Fleet management
- Chương 47: Service mesh (để hiểu mTLS federation)
- Chương 3–4: VPC networking, Cloud DNS
- Chương 21: Workload Identity (per-cluster version)
Tổng quan chương
Phần I: Nền tảng Multi-Cluster
01. Multi-Cluster Use Cases & Deployment Models
- Lý do chọn multi-cluster: HA/disaster recovery, geo-distribution, scale
- Trade-offs: complexity vs. resilience
- Deployment patterns: active-active, active-passive, hub-and-spoke
02. Multi-Cluster Services (MCS) Deep Dive
- ServiceExport/ServiceImport mechanics
- Cloud DNS integration để service discovery
- Endpoint propagation và eventual consistency
- Locality-aware load balancing
Phần II: Traffic Routing Global
03. Multi-Cluster Ingress (MCI) — Global Load Balancing
- Config cluster pattern
- Network endpoint groups (NEGs) cross-cluster
- Global HTTP(S) load balancer mechanics
- Health checking xuyên cluster
04. Gateway API cho Multi-Cluster Routing
- Gateway API abstraction (vs MCI custom resources)
- Multi-cluster Gateway configuration
- Cross-cluster backend selection
- HTTPRoute rules xuyên cluster
Phần III: Identity & Security
05. Workload Identity Across Clusters
- Identity sameness: same project = same pool
- Principal definitions cross-cluster
- Security implications: untrusted cluster risk
- IAM binding granularity
06. Cross-Cluster Service Mesh & Trust Federation
- mTLS federation giữa clusters
- Certificate distribution (Istio/ASM)
- Cross-cluster SPIFFE identity
- Service-to-service authentication
Phần IV: Network & DNS
07. Network Isolation & VPC Peering
- VPC peering topology (mesh vs. hub-and-spoke)
- Non-transitivity principle
- Firewall rules cross-peered networks
- Route exchange selective control
08. DNS Peering Across Clusters
- Cloud DNS peering mechanism
- Per-cluster private DNS zones
- Service discovery through DNS
- Failover DNS patterns
Core Concepts
Multi-Cluster Architecture Model
┌─────────────────────────────────────────────────┐
│ GKE Fleet (same project) │
├─────────────────────────────────────────────────┤
│ │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ Cluster A │ │ Cluster B │ │
│ │ │ │ │ │
│ │ Pod ns/svc │◄──►│ Pod ns/svc │ │
│ │ │ │ │ │
│ └──────────────┘ └──────────────┘ │
│ ▲ ▲ │
│ │ MCS ServiceImport │ VPC Peering │
│ │ Global LB (MCI) │ DNS Peering │
│ │ Service Mesh trust │ │
│ └────────┬───────────┘ │
│ │ │
│ ┌──────────────┐ │
│ │ Fleet Hub │ │
│ │ (Control) │ │
│ └──────────────┘ │
│ │
└─────────────────────────────────────────────────┘
Networking Layer:
- VPC Peering: Cluster A VPC ◄──► Cluster B VPC
- Firewall Rules: per-cluster, respect peering boundary
- DNS Zones: private zone per cluster, cross-zone peeringService Discovery Path (MCS)
Pod in Cluster A truy cập Service từ Cluster B:
1. Pod A tìm kiếm: svc-b.ns-b.svc.cluster.local
2. DNS (Cloud DNS) trả về: ServiceImport VIP (virtual IP)
3. iptables/eBPF DNAT: VIP ─► Endpoint Pod B (trong Cluster B subnet)
4. Packet gửi qua VPC Peering ─► Cluster B VPC ─► Pod B
5. Pod B reply qua peering ─► back to Pod ATraffic Routing Path (MCI)
Client truy cập Global LB:
1. DNS: app.example.com ─► Anycast IP (MCI IP)
2. Global LB: nhân Client ──► nearest POI (Point of Presence)
3. NEG (Network Endpoint Groups) tracking Pod endpoints từ:
- Cluster A NEG
- Cluster B NEG
- ...
4. Backend selection: health check ──► healthy Pod (nearest cluster)
5. Request routed ──► target cluster ──► PodKey Trade-Offs
| Aspect | MCS | MCI | Service Mesh |
|---|---|---|---|
| Scope | Cluster-to-cluster service discovery | Global ingress traffic routing | East-West traffic + security |
| Use Case | Microservices cross-cluster | External traffic distribution | Internal observability + mTLS |
| Latency Overhead | ~1-2ms (DNS lookup + routing) | <1ms (anycast POI) | ~10-50ms (sidecar proxy) |
| Identity | Per-request pod identity | Per-request client IP | mTLS certificate (SPIFFE) |
| Complexity | Medium (DNS + eventually consistent) | High (global LB + NEGs) | Very high (sidecar + admission) |
Phạm vi & Giới hạn
- Clusters trong cùng project: Workload Identity sameness → identity sharing
- Clusters trong projects khác: Separate identity pools → federation needed
- VPC peering: Non-transitive (A↔B, B↔C không suy ra A↔C)
- DNS peering: Per-cluster zones → separate zone discovery
- MCI: Config cluster + member clusters (star topology)
- Service Mesh: Trust federation requires explicit root CA sharing
Sự cố phổ biến
- Identity Leakage: Untrusted cluster shares WIF pool → unauthorized access
- Asymmetric Routing: Peering A→B hiệu quả nhưng B→A chậm → latency spike
- DNS TTL Cache: Old DNS entry after cluster failover → connection timeout
- PDB across Cluster: Workload distributed, PDB minAvailable không đủ → sudden eviction
- Service Mesh Trust Misconfiguration: Root CA mismatch → mTLS handshake failure
Danh sách các Subtopic
- 01. Multi-Cluster Use Cases & Deployment Models
- 02. Multi-Cluster Services (MCS) Deep Dive
- 03. Multi-Cluster Ingress (MCI) — Global Load Balancing
- 04. Gateway API cho Multi-Cluster Routing
- 05. Workload Identity Across Clusters
- 06. Cross-Cluster Service Mesh & Trust Federation
- 07. Network Isolation & VPC Peering
- 08. DNS Peering Across Clusters