Picture a production Kubernetes cluster that several people can change with kubectl. Someone scales a deployment during an incident, someone else edits a ConfigMap by hand, and a month later nobody can say what is actually running or why. GitOps was designed to end that drift.
The short answer: GitOps is a way of running deployments where a Git repository holds the desired state of your system, and an agent inside the cluster, such as Argo CD or Flux, keeps the cluster matching that repository. To change production you open a pull request instead of running commands. Merged changes are applied automatically, and manual changes are detected and reverted.
It builds directly on Git, Kubernetes and CI/CD, so it is a natural next step after the core topics in any DevOps training in Pune. This guide explains the idea, how Argo CD works, and how to try it on a laptop.
The four ideas behind GitOps
The OpenGitOps project, part of the CNCF, describes four principles. In plain terms, they are:
- Declarative: you describe what the system should look like, such as three replicas of version 2.4, not the steps to get there.
- Versioned and immutable: that description lives in Git, so every change has an author, a review and a history.
- Pulled automatically: an agent in the cluster fetches the desired state, rather than a CI server pushing into the cluster.
- Continuously reconciled: the agent keeps comparing the live cluster with Git and fixes any difference it finds.
Push-based CD versus pull-based GitOps
In a typical pipeline, the CI server builds an image and then runs kubectl apply or helm upgrade against the cluster. That is push-based deployment. It works, but the CI system needs credentials to production, and nothing notices if someone changes the cluster by hand afterwards.
With GitOps, CI stops at building and testing the image, then updates a tag in a Git repository. The agent inside the cluster sees the commit and applies it. Production credentials never leave the cluster, and the agent keeps watching, so drift gets caught. Our explainer on CI/CD pipelines covers the build half of this flow.
How Argo CD works
Argo CD is one of the most widely used GitOps tools and has a web UI that makes the idea easy to see. You install it into the cluster, then create an Application that says which repository, folder and branch to watch, and which cluster and namespace to deploy into.
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: shop
namespace: argocd
spec:
project: default
source:
repoURL: https://github.com/your-org/shop-config.git
targetRevision: main
path: envs/prod
destination:
server: https://kubernetes.default.svc
namespace: shop
syncPolicy:
automated:
prune: true
selfHeal: true
The two settings at the bottom do most of the work. prune deletes resources that were removed from Git, and selfHeal undoes manual changes made in the cluster. In the UI, each app shows as Synced when the cluster matches Git, or OutOfSync when it does not, with a diff of exactly what differs.
The path can point at plain YAML, a Kustomize folder or a Helm chart. If you have read our guide to Helm for beginners, the same chart and values files can be deployed this way without any helm upgrade commands.
Argo CD or Flux?
Flux is the other major GitOps project, and both are graduated CNCF projects. Argo CD is often chosen for its UI and multi-cluster dashboard, which helps teams new to GitOps see what is going on. Flux is lighter, works mainly through Kubernetes resources and the command line, and suits teams that prefer everything as code.
The concepts transfer almost completely, so pick one to learn properly. Argo CD tends to be easier for a first hands-on attempt because you can watch syncs and diffs happen in the browser.
How a change reaches production
Here is a realistic flow for a team using GitOps with two repositories, one for application code and one for configuration:
- A developer merges a feature into the app repository.
- CI builds and tests the code, pushes an image tagged with the commit ID, and opens a pull request in the config repository that changes the image tag for staging.
- The pull request is reviewed and merged. Argo CD sees the commit and syncs staging.
- After checks pass, a second pull request promotes the same tag to production.
- If production misbehaves, the team reverts that commit, and Argo CD rolls the cluster back.
Every step is a commit, so the Git history becomes the audit trail. That is a big reason regulated companies, such as banks and insurers, find GitOps attractive. Comfort with branches, pull requests and reverts matters a lot here; see Git for DevOps beginners if those still feel shaky.
What GitOps does not solve
GitOps is not a fit for everything. Secrets cannot sit in Git as plain text, so teams add tools such as Sealed Secrets, SOPS or External Secrets. Database schema changes and one-off jobs need extra thought, because reconciling them again and again is not what you want. And GitOps mainly targets Kubernetes; managing cloud resources the same way usually needs Terraform plus extra tooling.
Try it on your laptop in an evening
# 1. Create a local cluster
kind create cluster --name gitops
# 2. Install Argo CD
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
# 3. Open the UI on https://localhost:8080
kubectl port-forward svc/argocd-server -n argocd 8080:443
# 4. Get the initial admin password
kubectl -n argocd get secret argocd-initial-admin-secret
-o jsonpath="{.data.password}" | base64 -d
Then push a simple Deployment and Service to a GitHub repository of your own, create an Application pointing at it, and watch it sync. Change the replica count in Git and see the cluster follow. Finally, scale the deployment by hand with kubectl and watch self-heal put it back. That last moment is when GitOps usually clicks.
Frequently asked questions
Is GitOps the same as CI/CD?
No. GitOps is one way of doing the CD part. CI still builds and tests code; GitOps changes how the result is deployed, by having the cluster pull changes from Git instead of a pipeline pushing them.
Do I need to know Kubernetes before learning GitOps?
Yes. Argo CD and Flux deploy Kubernetes resources, so you should be comfortable with Deployments, Services, namespaces and kubectl before starting.
Can I use Helm with Argo CD?
Yes. Argo CD can deploy Helm charts directly, using your values files from Git. It renders the chart itself and tracks the resulting resources like any other app.
Is GitOps only for large companies?
No. A single small cluster benefits from the audit trail and drift detection, and Argo CD runs comfortably on a laptop cluster for learning.




