--- title: "Pull Model" type: concept tags: [DevOps, GitOps, CD, 部署] sources: [ctp-topic-33-an-introduction-to-gitops.md] last_updated: 2026-04-19 --- ## Definition Pull Model(拉取模型)是 GitOps 推荐的一种持续交付实现模式,GitOps Agent 持续监控 Git 仓库和目标系统的状态,自动将 Git 中的期望状态同步到实际运行环境。 ## How It Works 1. GitOps Agent 安装在目标环境(如 Kubernetes 集群) 2. Agent 持续轮询 Git 仓库检测配置变化 3. Agent 同时监控实际系统状态 4. 当检测到差异时,自动将变更同步到目标系统 ## Advantages - 更安全:无需开放外部访问权限到集群 - 更好的可见性:Agent 直接观察实际状态 - 自我修复:自动纠正配置漂移 - 简化网络架构:无需入站 webhook ## Comparison with Push Model | 特性 | Pull Model | Push Model | |------|-----------|------------| | 触发方式 | Agent 主动拉取 | CI/CD 流水线推送 | | 部署位置 | Agent 运行在目标环境 | CI/CD 工具运行在外部 | | 安全性 | 更高,无需开放入站端口 | 需要开放 webhook 端口 | | 复杂度 | 较低(无外部依赖) | 较高(需要 CI/CD 集成) | ## Related Concepts - [[GitOps]] - [[CI/CD 流水线]] - [[Idempotent Operation]](幂等操作) ## Related Sources - [[ctp-topic-33-an-introduction-to-gitops]] — GitOps 入门介绍