Đưa workload lên Kubernetes thế nào để scale và self-heal mà không tạo platform đội ngũ không vận hành nổi?
Một hệ thống có API, worker và dữ liệu stateful; đội muốn dùng Kubernetes nhưng chưa chốt SLO, failure domain, capacity, storage, security và đường phục hồi.
Chọn platform, controller, topology và operating model; làm rõ trade-off giữa control, reliability và complexity.
Network và node có thể lỗi; control loop chỉ reconcile desired state; dữ liệu và business correctness cần cơ chế riêng.
- Workload và SLO nào cần Kubernetes?
- Mất node/zone thì dữ liệu và traffic ra sao?
- Ai sở hữu upgrade, security và on-call?
- Bằng chứng nào chứng minh phục hồi?
Bước 1 · Làm rõ workload và SLO
Không bắt đầu bằng manifest; xác định request/batch/stateful, critical journey, RPO/RTO và owner.
flowchart LR B[Business outcome] --> W[Workload + SLO] W --> K{Kubernetes phù hợp?} K --> A[Architecture + operating model]
Bước 2 · Chọn Kubernetes có đáng không
So VM/PaaS/serverless/managed Kubernetes theo control và operational burden.
Bước 3 · Vẽ cluster và failure domain
Control plane, node pool, zone, network, storage và responsibility boundary.
Bước 4 · Chọn workload controller
Deployment/StatefulSet/DaemonSet/Job theo identity, lifecycle và completion.
Bước 5 · Đặt resource và scheduling
Requests/limits, QoS, affinity, taint, topology và quota theo capacity model.
Bước 6 · Thiết kế serving lifecycle
Startup/readiness/liveness, rollout, PDB và graceful shutdown.
Bước 7 · Nối network và storage
Service/DNS/Gateway/Policy cùng PV/PVC/CSI theo đúng failure semantics.
Bước 8 · Scale có downstream budget
HPA/node capacity/backpressure theo workload signal và bottleneck thật.
Bước 9 · Bảo vệ identity và supply chain
ServiceAccount/RBAC/admission, image, config, secret, Helm/Kustomize.
Bước 10 · Vận hành cluster lifecycle
Upgrade, node drain, control plane, etcd backup/restore và managed responsibility.
Bước 11 · Quan sát và diễn tập
Business SLI + Kubernetes conditions/Events/logs; incident, reconciliation và game day.
flowchart LR W[Workload] --> C[Controller] C --> R[Resources + scheduling] R --> N[Network + storage] N --> L[Lifecycle + scaling] L --> S[Security + delivery] S --> O[Observe + recover]
Văn nói phỏng vấn · 90 giây
“Khi thiết kế Kubernetes, em bắt đầu từ workload, SLO, RPO/RTO và năng lực đội ngũ để xác định Kubernetes có thật sự đáng dùng. Nếu chọn, em vẽ failure domain của control plane, node, network và storage; chọn controller theo identity và lifecycle. Requests, limits và scheduling phải dựa trên capacity model, còn probe, rollout, PDB và graceful shutdown bảo vệ serving lifecycle. Em không coi autoscaling là vô hạn: HPA phải gắn downstream budget và node capacity. Security gồm workload identity, RBAC, admission, image và secret; delivery cần manifest có version và kiểm chứng. Cuối cùng, self-healing compute không thay backup hay DR, nên em theo dõi cả Kubernetes conditions lẫn business SLI và diễn tập node loss, rollout lỗi, restore theo acceptance criteria.”
Theo dấu một ứng dụng qua năm luồng
Dùng cùng ví dụ orders-api. Mỗi bài bắt đầu từ một câu hỏi thực tế, đi qua các thành phần và thứ tự phối hợp, rồi thử đổi một điều kiện để tập khoanh vùng sự cố.
- Kiến trúc cluster · từ apply tới container
- Pod lifecycle · từ Running tới Ready
- Deployment · từ v1 tới v2 và canary
- Networking · từ client tới Ready Pod
- Autoscaling · từ metric tới capacity phục vụ
C4 gợi ý vẽ sơ đồ cho từng luồng tương tác cụ thể. arc42 bổ sung cách chọn kịch bản vận hành và lỗi tiêu biểu để thấy các thành phần phản ứng ra sao. Năm bài áp dụng hai cách này qua sơ đồ Mermaid, ví dụ và bài tự kiểm tra. C4 Dynamic Diagram · arc42 Runtime View
Học sâu
12 bài kiến thức · 42 tình huống · 10 case SA · 15 câu phỏng vấn · 9 lab