Skip to content

Introduction to GitOps: Concepts, Push vs. Pull, and Argo CD Components

Interactive Diagram

새 탭 ↗

This post is the starting point of the GitOps series. Before configuring FluxCD, Flagger, and Argo CD in later posts, it sets out what GitOps changes and the criteria for judging it.

GitOps is an operating model in which deployment state is described in declarative files kept in a Git repository, and a controller inside the cluster continuously closes the gap between that declaration and the actual state. When you push Kubernetes resources to Git, the cluster drifts from the repository, and the controller detects the difference and synchronizes (syncs) it.

  • Git records the desired state and its change history. Commits and pull requests show who changed what and when.
  • The actual deployment state comes from the controller’s sync/health status, not from Git. A merged commit does not mean the Pods are healthy.
  • When rolling back to an earlier revision, you still need to verify image availability, data, and external-dependency compatibility. Reverting manifests does not revert a database schema or an external API.

OpenGitOps defines GitOps with four principles.

PrincipleMeaningWhat to check in operation
DeclarativeDescribe the desired result, not the procedureNo step still depends on the order of kubectl apply
Versioned and ImmutableKeep the desired state in a store that retains historyNo direct changes (kubectl edit) happen outside that history
Pulled AutomaticallyAn agent pulls declarations from the storeCI does not hold cluster credentials
Continuously ReconciledThe actual state is continuously observed and aligned with the desired stateDrift is detected and either corrected or alerted on

IaC is the broader concept. GitOps focuses on an operating model in which Git is the source and a controller continuously reconciles. In practice, a common combination is to create clusters and cloud resources with Terraform and manage the Kubernetes resources on top with GitOps.

GitOpsIaC
Main targetKubernetes resources (mostly)All infrastructure (local, cloud, Kubernetes)
SourceGitCan use stores other than Git
How changes applyA controller in the cluster pulls and reconcilesA tool applies at run time (plan/apply)
Typical toolsArgo CD, FluxTerraform, Ansible, Chef, etc.

In push-based delivery, the CI pipeline builds and then deploys directly to the cluster. It is simple to set up, but CI must hold cluster credentials, and it cannot detect when someone changes resources directly after deployment.

Push-based delivery

In pull-based delivery, a GitOps controller inside the cluster watches Git and applies the differences. CI builds the image and only updates the image tag in the manifest, so cluster credentials never leave the cluster. Drift caused by direct changes also surfaces at the next reconcile.

Pull-based delivery

PlantUML Diagram

Argo CD is the most common tool that implements this flow inside Kubernetes.

PlantUML Diagram
ComponentRoleSymptom when it fails
API ServerHandles Web UI, CLI, and API requests; applies authentication and RBACUI/CLI unavailable. Syncs already in progress continue in the controller
Repository ServerFetches manifests from Git and renders Helm, Kustomize, and so onComparisonError, rendering timeouts
Application ControllerCompares desired and live state and determines sync and healthStatus stops updating, automated sync stalls
DexOptional SSO (OIDC) broker to an external IdPSSO login fails
RedisCache for rendered results and cluster state; holds only rebuildable dataSlower responses. After a restart the cache is rebuilt
Notifications ControllerSends sync and health events to Slack, email, and so onMissed notifications
  • Git revert is the default. Reverting the desired state to an earlier commit keeps the history, and the controller converges to that state.
  • You can’t use Argo CD’s rollback on an Application with automated sync enabled. Automated sync would overwrite it with the Git state again. To roll back urgently, disable automated sync, roll back, and then bring Git to the same state.
  • Reverting manifests does not revert the whole system. Check that the previous image tag still exists in the registry, that database migrations are backward compatible, and that external API contracts have not changed.