ArgoCD GitOps Tutorial 2026 - Continuous Deployment
ArgoCD GitOps Tutorial 2026: Continuous Deployment
Traditional deployment pipelines push changes to Kubernetes using CI/CD tools — Jenkins or GitHub Actions runs kubectl apply after a successful build. This works, but it has problems: pipeline credentials need access to the cluster, the desired state lives in the pipeline rather than Git, and auditing who deployed what requires digging through pipeline logs.
GitOps flips this model. Instead of the CI/CD system pushing to Kubernetes, a tool running inside the cluster continuously pulls the desired state from Git and applies it. Git becomes the single source of truth. ArgoCD is the most popular GitOps tool for Kubernetes.
How ArgoCD Works
- Developers commit application Kubernetes manifests (or Helm charts) to a Git repository
- ArgoCD watches the Git repository for changes
- When a change is detected, ArgoCD compares the Git state with the live cluster state
- If they differ, ArgoCD syncs the cluster to match Git (either automatically or after manual approval)
- Every deployment is tracked in Git — full audit trail, easy rollbacks
Installing ArgoCD
# Install ArgoCD in its own namespace
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
# Wait for all pods to be ready
kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=argocd-server -n argocd --timeout=120s
# Access the ArgoCD UI locally
kubectl port-forward svc/argocd-server -n argocd 8080:443
# Get the initial admin password
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo
# Open https://localhost:8080 and login with admin /
Deploying Your First Application with ArgoCD
Create an Application manifest that tells ArgoCD where your Git repo is and what to deploy:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: myapp-production
namespace: argocd
spec:
project: default
source:
repoURL: https://github.com/myorg/myapp-manifests
targetRevision: main
path: environments/production # folder in the repo
destination:
server: https://kubernetes.default.svc
namespace: production
syncPolicy:
automated:
prune: true # delete resources removed from Git
selfHeal: true # re-sync if someone manually changes cluster
syncOptions:
- CreateNamespace=true
kubectl apply -f argocd-application.yaml
Now every time you push a change to the environments/production folder in Git, ArgoCD automatically deploys it to the cluster.
ArgoCD with Helm Charts
ArgoCD natively supports Helm. Point it at a Helm chart with environment-specific values:
spec:
source:
repoURL: https://github.com/myorg/helm-charts
targetRevision: main
path: charts/myapp
helm:
valueFiles:
- values-production.yaml
parameters:
- name: image.tag
value: "v1.5.2"
Multi-Environment Setup with ApplicationSet
ApplicationSet lets you create multiple Applications from a template — perfect for managing dev/staging/production from a single definition:
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: myapp-environments
namespace: argocd
spec:
generators:
- list:
elements:
- env: development
cluster: dev-cluster
branch: develop
- env: staging
cluster: staging-cluster
branch: main
- env: production
cluster: prod-cluster
branch: main
template:
metadata:
name: myapp-{{env}}
spec:
source:
repoURL: https://github.com/myorg/myapp-manifests
targetRevision: "{{branch}}"
path: "environments/{{env}}"
destination:
server: "{{cluster}}"
namespace: myapp
Rollback: The Killer Feature
Because every deployment is tied to a Git commit, rolling back is as simple as reverting a Git commit — or clicking "Sync to Previous Version" in the ArgoCD UI. No manual kubectl commands, no searching through pipeline logs.
# Roll back to a specific revision via CLI
argocd app rollback myapp-production 5
# Or sync to a specific Git commit
argocd app sync myapp-production --revision abc1234
ArgoCD vs Jenkins for Deployments
| Aspect | Jenkins (Push) | ArgoCD (Pull/GitOps) |
|---|---|---|
| Cluster credentials | Stored in Jenkins (risky) | ArgoCD runs inside cluster (safer) |
| Audit trail | Pipeline logs | Git history (permanent, clear) |
| Drift detection | None — manual changes undetected | Automatic — alerts and self-heals |
| Rollback | Re-run old pipeline | Click or git revert |
GitOps with ArgoCD is increasingly standard at Indian product companies and is a topic that comes up in senior DevOps interviews. Our training covers ArgoCD setup and GitOps workflows as part of a complete CI/CD module with real projects. See the course details →
Ready to Start Your DevOps Career?
Join our comprehensive DevOps course and get job-ready in 56 days
Enroll Now - Limited Seats