GitOps = Git là single source of truth cho cả app code lẫn infrastructure state — cluster tự reconcile để match Git, không có ai kubectl apply bằng tay. Nguyên tắc cốt lõi:
- Declarative — toàn bộ state mô tả bằng YAML/Helm/Kustomize trong Git;
- Versioned & immutable — mọi thay đổi qua PR, history rõ ràng;
- Pulled automatically — agent trong cluster pull config từ Git, không push từ CI;
- Continuously reconciled — agent detect drift và tự sửa. ArgoCD: agent chạy trong K8s cluster, watch Git repo, sync resources tới namespace target
UI đẹp, hỗ trợ multi-cluster, app-of-apps pattern, sync waves, hooks.
Truy cập qua argocd CLI hoặc web UI. Flux (CNCF graduated): nhỏ gọn hơn ArgoCD, không có UI native (dùng Flux extension hoặc Weave GitOps), tích hợp tốt với Kustomize và Helm Controllers, có Image Automation Controller tự bump image tag khi có release mới. Lợi ích GitOps: audit trail (mọi deploy đều có commit), rollback bằng git revert, disaster recovery (cluster gone? re-create từ Git), no CI credentials in cluster (pull thay vì push — bảo mật hơn). Trade-off: thêm 1 component (Argo/Flux) phải maintain; debug khó hơn khi sync fail; phải educate team về branch strategy cho config repo.