Shipping code to Kubernetes the old way means running kubectl apply from your laptop or CI runner and hoping the cluster ends up matching what you intended. A GitOps deployment with ArgoCD reverses that flow. Instead of pushing changes into the cluster, you declare the desired state in a git repository, and ArgoCD, an agent running inside the cluster, pulls that state in and keeps everything in sync on its own. Git becomes the single source of truth for your infrastructure. No one has to wonder who changed what in production, and the gap between what you think is deployed and what actually runs disappears.
GitOps Principles: The Four Rules Behind the Idea
The GitOps principles were first written down by the team at Weaveworks, and they still read like a checklist for sane deployments:
- Declarative. Everything about your system, deployments, services, config maps, is described as data in files, usually YAML. Nothing important lives only in someone’s shell history.
- Versioned and immutable. Those files live in git. Every change is a commit with an author, a message, and a history you can roll back.
- Pulled automatically. A software agent pulls the desired state from git and applies it. Nobody needs kubectl access to production for routine deploys.
- Continuously reconciled. The agent keeps comparing the cluster against git and corrects drift, so the live state converges back to the declared state.
If your workflow checks all four boxes, you are doing GitOps. The box you miss usually tells you exactly what to fix next.
Pull vs Push: Why Pull-Based Deploys Are Safer
Most CI pipelines deploy the push way. The pipeline builds a container image, then pushes manifests into the cluster using kubectl credentials stored in the CI system. It works, but it has two weak spots. First, your CI system holds the keys to production. If the CI server is compromised, the cluster goes with it. Second, nothing watches for drift. If someone hot-fixes a deployment by hand, the pipeline has no idea until the next run overwrites it or ignores it.
Pull-based deploys move the responsibility into the cluster. ArgoCD runs inside and reaches out to git, so the CI system never needs cluster credentials and the attack surface shrinks. Because ArgoCD watches continuously, a manual hot-fix shows up as drift the moment it happens, and you can have it reverted automatically. For teams that deploy often, that closed loop is the main reason to switch.
GitOps Deployment with ArgoCD: How the Sync Loop Works
The ArgoCD sync loop has three moving parts. The repo server reads your git repository and renders the manifests, whether plain YAML, Helm charts, or Kustomize overlays. The application controller compares the rendered manifests against the live state of the cluster, every few minutes or on each git webhook. The API server and web UI show the result: every application is either In Sync or Out of Sync.
When you push a commit, the loop spots the difference and applies it, depending on your sync policy. The full history of what changed, when, and by whom lives in git, so git log doubles as your deployment audit trail.
The ArgoCD Application CRD
The ArgoCD Application CRD is the piece that ties a git path to a cluster namespace. Here is a minimal example:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: web-shop
namespace: argocd
spec:
project: default
source:
repoURL: https://github.com/example/shop-manifests.git
targetRevision: main
path: overlays/production
destination:
server: https://kubernetes.default.svc
namespace: shop
syncPolicy:
automated:
prune: true
selfHeal: true
This one file says: watch the main branch of that repo, take the production overlay, and keep the shop namespace matching it. Change a replica count in git, and the cluster follows.
Sync Policies: Automatic or Manual
Two switches control how eager the sync loop is. With manual sync, ArgoCD shows the diff and waits for a click, or an argocd app sync command, before applying anything. That is a good starting point while you learn the tool. With automated sync, every commit flows to the cluster on its own. Two sub-options matter here: prune deletes resources that were removed from git, and selfHeal reverts manual changes made directly in the cluster. Start manual, switch to automated once you trust the loop, and turn on selfHeal when drift starts costing you sleep.
Getting Started in Five Steps
You can run ArgoCD on a test cluster in a single afternoon:
- Install it.
kubectl create namespace argocd, thenkubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml. - Open the UI. Port-forward the server with
kubectl port-forward svc/argocd-server -n argocd 8080:443and log in with the initial admin secret. - Connect a repo. Use the official example apps repo (
argoproj/argocd-example-apps) or your own manifests repository. - Create an Application, in the UI or with an Application YAML like the one above, mapping a repo path to a namespace.
- Push a change to git and watch the UI flip to Out of Sync, then back to Synced as the cluster converges.
That loop, commit, sync, verify in the UI, is the whole GitOps experience. Everything after that is refinement: multiple environments, progressive delivery, sealed secrets.
GitOps and ArgoCD FAQ
Is ArgoCD a CI tool?
No. ArgoCD covers the CD half: it takes already-built artifacts and keeps the cluster in sync with git. Pair it with whatever builds your images, GitHub Actions, Jenkins, or GitLab CI. ArgoCD is not the only controller built on this pattern, either; ArgoCD vs Flux is a genuine choice, and we compared the two directly.
Does GitOps only work with Kubernetes?
ArgoCD itself is Kubernetes-native, but the underlying pattern, declarative desired state in git pulled by an agent, works anywhere you can run a reconciler. For plain VMs, Ansible in pull mode follows the same idea. It is, at heart, infrastructure as code applied to deployment state: declarative files in git, reviewed like code, reconciled by machines.
How much does ArgoCD cost?
ArgoCD is open source under the Apache 2.0 license, so the software itself costs nothing. If you are evaluating managed Kubernetes or managed GitOps offerings around it, check official pricing, since it varies by provider.
What happens if someone edits the cluster by hand?
ArgoCD flags the difference as drift. With selfHeal enabled it reverts the change automatically. Without it, you get a visible Out of Sync warning and can sync back manually. Either way, nothing stays hidden.
Should You Adopt GitOps?
If you deploy to Kubernetes a few times a week and you have been bitten by mystery drift, a replica count that changed on its own, a config nobody remembers editing, a GitOps deployment with ArgoCD pays for itself fast. The install takes an afternoon, the mental model takes a day, and the payoff is a production cluster you can reason about from git history alone. Start with one non-critical app on manual sync. When that feels boring, automate it.