# DevOps Notes (GitOps) # GitOps   | Container orchestration system | Kubernetes | | --- | --- | | Git Repository | GitHub、GitLab | | CI/CD pipeline | Azure DevOps、GitHub Actions、Jenkins、GitLab CI/CD、Circle CI | | GitOps operator | ArgoCD、Flux | - 只有一個存 Deployment config 的 repository可以動到系統,並且所有系統上的狀態都描述在這些描述檔裡 (yaml/helm chart/…),管理起來非常有條理 - Kubernetes 內會安裝相對應的 controller 來監控 Git Repo 的更新並且將一切的更新都更新到 kubernetes cluster 內 - GitOps 關注的是如何自動化部署(CD),跟 **CI**, **Pipeline** 關係不大 ## 實現方法 ### 基本建構 1. **建立Git repo** 2. **建立 CI/CD 流程**:建立自動化 CI/CD 流程,從 Git code 建構容器映像 (container image)、測試/部署應用程式。 3. **定義 K8S 資源文件**:使用 K8S yaml file 定義 K8S 資源,像是 Pod、Service、Deployment、ConfigMap等 ### 設定 1. **將 K8S 資源 commit 到 Git Repository** 2. **使用 GitOps 工具自動部署**:使用 Argo CD、Flux 等 GitOps 工具,自動從 Git Repository 中 pull 最新版本 & deploy 到 K8S 環境中 3. **GitOps 工具定期進行同步和比較**:使用 GitOps 工具定期 pull & 比較,確保一致 ## ****GitOps 解決痛點**** - **部署的無法重複性**:一般的 DevOps 方法很難確保 K8S 內運行的狀態與描述的資源檔案 (Yaml/Helm Chart) 完全一致 - **資安風險**:用 command 操作 Kubernetes Cluster 時,Kubernetes Cluster 的連線資訊 (KUBECONFIG) 是人為傳遞,一旦暴露會有很大的資安的風險
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up