Auto-sync: 2026-04-20 00:02

This commit is contained in:
2026-04-20 00:02:56 +08:00
parent 8341ee6cc4
commit 6ab2838935
104 changed files with 4077 additions and 31 deletions

View File

@@ -2,20 +2,52 @@
title: "GitOps"
type: concept
tags: [DevOps, Git, 基础设施, 部署]
sources: [DevOps-Culture-and-Transformation.md]
last_updated: 2025-03-02
sources: [DevOps-Culture-and-Transformation.md, ctp-topic-33-an-introduction-to-gitops.md]
last_updated: 2026-04-19
---
## Definition
GitOps 是一种使用 Git 作为单一真相源Single Source of Truth来管理基础设施和部署的文化理念和运维框架所有配置和部署声明都存储在 Git 仓库中。
GitOps 是一种使用 Git 作为单一真相源Single Source of Truth来管理基础设施和部署的文化理念和运维框架所有配置和部署声明都存储在 Git 仓库中。它是 DevOps 的逻辑演进,将软件开发原则应用于部署流程。
## Key Principles关键原则)
- 声明式基础设施
- Git 作为单一真相源
- 自动同步和部署
- 可审计和可回滚
## Key Principles四大原则)
1. **Declarative Configuration**(声明式配置):系统以声明形式定义,描述期望状态而非具体步骤
2. **Version Control**(版本控制):所有配置存储在 Git 中,实现版本管理和审计追踪
3. **CD Process Separation**CD 流程分离CI 和 CD 解耦以增强安全性
4. **Incremental Infrastructure**(增量基础设施):渐进式实施基础设施变更
## Related Concepts
- [[DevOps 文化]]
- [[Infrastructure as Code (IaC)]]
## Core Benefits核心优势
- 使用开发者熟悉的工具提升开发生产力
- 通过轻松的回滚能力最小化失败部署
- 支持更快的功能发布
- 通过 Git 特性实现实时审计和改进安全性
## Key Components核心组件
- **Git**:存储部署基础设施和应用配置,作为唯一真相源
- **GitOps Controller**:协调 Git 状态与实际系统状态的代理
- **CD Pipeline**:自动化部署流程
- **Infrastructure as Code**:通过代码管理基础设施
## Implementation Models实现模型
- **Pull Model**拉取模型GitOps 推荐模型,监控 Git 和目标系统,自动同步变更
- **Push Model**(推送模型):传统 CI/CD 部署模式,通过触发器推送变更
## Kubernetes Workflow
1. 开发者提交代码
2. 创建容器镜像
3. 将部署配置存储在 Git 中
4. GitOps Agent 监控变化
5. 向环境推出镜像
## Key Concepts
- [[Declarative Configuration]](声明式配置)
- [[Infrastructure as Code (IaC)]](基础设施即代码)
- [[CI/CD 流水线]]
- [[Pull Model]](拉取模型)
- [[Idempotent Operation]](幂等操作)
## Related Entities
- [[Victor Etkin]] — GitOps 概念的演讲者和布道者
## Related Sources
- [[ctp-topic-33-an-introduction-to-gitops]] — GitOps 入门介绍
- [[DevOps-Culture-and-Transformation]] — DevOps 文化转型