Skip to content

Что такое GitOps

Коротко:

GitOps — paradigm, где entire system state (application manifests, infra) хранится в Git, а agents в cluster continuously sync actual state с desired. Термин coined Weaveworks 2017. 4 principles: **Declarative**, **Versioned in Git**, **Automatically applied**, **Continuously reconciled**. Tools: ArgoCD (most popular), Flux CD, Jenkins X. Replaces: kubectl apply в CI/CD scripts.

Ниже: подробности, пример, смежные термины, FAQ.

Подробности

  • Repo structure: Dev manifests + prod manifests + environment overlays
  • Pull-based: agent в cluster pulls changes (vs CI push)
  • Drift detection: alerts если cluster state ≠ Git
  • Rollback = git revert + auto-sync
  • Auth: agents use read-only Git + K8s RBAC

Пример

# ArgoCD Application
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: my-app
spec:
  source:
    repoURL: https://github.com/me/manifests
    targetRevision: main
    path: apps/my-app
  destination:
    server: https://kubernetes.default.svc
    namespace: my-app
  syncPolicy:
    automated: { prune: true, selfHeal: true }

Смежные термины

Больше по теме

Часто задаваемые вопросы

GitOps vs CI/CD?

Overlap. CI/CD — pipeline, который deploy. GitOps — pattern of operating systems through Git as truth. GitOps часто uses CI для build image + PR to manifest repo.

Secrets в Git — как?

НЕ plain. Tools: SealedSecrets (encrypted YAML), External Secrets Operator (sync from Vault), SOPS (Mozilla).

Monorepo или split?

Split: app-code repo + manifests repo. Avoids CI reinvocation при manifest-only changes. Популярнее в 2026.