Introduction
Deploying applications on Kubernetes is powerful, but doing it manually again and again using kubectl can become slow, error-prone, and hard to manage. Many teams face issues like missed updates, wrong configurations, and no clear history of changes.
This is where GitOps with ArgoCD helps.
In simple words, GitOps means: your Git repository becomes the main control system for your application deployment. You just push changes to Git, and ArgoCD automatically updates your Kubernetes cluster.
This approach is widely used in modern DevOps, cloud computing, and CI/CD pipelines because it is reliable, traceable, and easy to scale.
What is GitOps in Kubernetes?
GitOps is a deployment approach where your entire Kubernetes setup (applications, configs, services) is stored in a Git repository.
How GitOps works in simple words
You write Kubernetes YAML files (Deployment, Service, etc.)
You store them in GitHub, GitLab, or Bitbucket
Any change in Git triggers deployment automatically
The cluster always matches what is written in Git
Real-life example
Think of Git like a “remote control” for your infrastructure.
Before GitOps:
You manually press buttons (kubectl commands) every time.
After GitOps:
You just change something in Git, and everything updates automatically.
This makes Kubernetes deployment faster and safer.
What is ArgoCD?
ArgoCD is a GitOps continuous delivery (CD) tool made specifically for Kubernetes.
It watches your Git repository and ensures that your Kubernetes cluster always stays in sync with it.
Key features of ArgoCD
Automated deployment
Whenever you push changes to Git, ArgoCD deploys them automatically.
Self-healing system
If someone manually changes something in Kubernetes, ArgoCD detects it and fixes it.
Easy rollback
You can go back to any previous version directly from the UI.
Visual dashboard
ArgoCD provides a UI where you can see app status, sync state, and errors.
Simple understanding
ArgoCD = Git watcher + Kubernetes deployer
How ArgoCD GitOps Workflow Works
Let’s understand the full GitOps workflow step by step.
Step-by-step flow
Developer updates code or YAML in Git
Code is pushed to repository (GitHub/GitLab)
ArgoCD detects the change
ArgoCD compares desired state (Git) vs actual state (cluster)
ArgoCD applies required changes
Before vs After GitOps
Before using GitOps:
After using GitOps with ArgoCD:
Fully automated deployments
Everything tracked in Git history
Easy rollback and debugging
This is why GitOps is becoming standard in DevOps.
Prerequisites for ArgoCD Kubernetes Deployment
Before starting, make sure your environment is ready.
Required tools
Kubernetes cluster (Minikube, EKS, GKE, AKS)
kubectl installed and configured
Git repository (GitHub recommended)
Basic knowledge of YAML and Kubernetes concepts
Beginner tip
If you are new, start with Minikube locally. It is simple and good for practice.
Step 1: Install ArgoCD in Kubernetes Cluster
First, create a separate namespace for ArgoCD.
kubectl create namespace argocd
Now install ArgoCD using official manifests:
kubectl apply -n argocd -f
What happens internally?
You can verify installation using:
kubectl get pods -n argocd
Step 2: Access ArgoCD Dashboard (UI)
To access ArgoCD UI locally:
kubectl port-forward svc/argocd-server -n argocd 8080:443
Open browser:
https://localhost:8080
Get login password
kubectl get secret argocd-initial-admin-secret -n argocd -o yaml
Decode it and login using:
Why UI is important?
Monitor deployments
Check sync status
Debug issues easily
Step 3: Prepare Git Repository for Kubernetes Deployment
Now create a Git repository that contains Kubernetes YAML files.
Recommended folder structure
app/
deployment.yaml
service.yaml
Example deployment file
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
replicas: 2
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-app
image: nginx
ports:
- containerPort: 80
Simple explanation
This file tells Kubernetes how to run your application.
Step 4: Connect Git Repository to ArgoCD
Now link your Git repository with ArgoCD.
Using UI
Using CLI
argocd repo add
Why this step matters?
Without connecting Git, ArgoCD cannot read your application configuration.
Step 5: Create Application in ArgoCD
Now create an application that connects Git and Kubernetes.
argocd app create my-app \
--repo \
--path app \
--dest-server \
--dest-namespace default
What each parameter means
repo = your Git repository
path = folder where YAML exists
dest-server = Kubernetes cluster
namespace = where app will run
This step defines your deployment pipeline.
Step 6: Sync Application (Deploy to Kubernetes)
Now deploy your application:
argocd app sync my-app
What happens here?
Output
Your application will be running inside Kubernetes.
Step 7: Enable Auto-Sync (Continuous Deployment)
To automate deployment completely:
argocd app set my-app --sync-policy automated
What this does
This is the core of GitOps automation.
Step 8: Update Application (Real DevOps Example)
Let’s say you want to scale your app.
Before:
replicas: 2
After:
replicas: 3
What you do
Update file in Git
Commit and push
What ArgoCD does
No kubectl command needed.
Step 9: Rollback Deployment Using ArgoCD
If deployment fails or bug appears:
Using UI
Open ArgoCD dashboard
Select previous version
Click Rollback
Why rollback is powerful
Quick recovery from failure
No need to manually fix configs
Saves production downtime
Advantages of ArgoCD GitOps Workflow
Fully automated deployment
No need for manual commands, everything runs automatically.
Version control with Git
Every change is tracked and reversible.
Faster debugging
You can check exactly what changed and when.
Self-healing system
If cluster state changes manually, ArgoCD fixes it.
Better team collaboration
Developers and DevOps teams work using Git workflows.
Disadvantages of ArgoCD GitOps
Initial setup complexity
Beginners may find setup confusing.
Requires Git discipline
All changes must go through Git only.
Learning curve
Understanding GitOps takes some time.
Common Mistakes to Avoid in Kubernetes GitOps
Manual changes in cluster
Avoid using kubectl directly after GitOps setup.
Poor Git structure
Keep your repo clean and organized.
Not enabling auto-sync
Without this, GitOps becomes semi-manual.
Hardcoded values
Use environment configs instead of hardcoding.
Real-World Use Case of ArgoCD GitOps
A startup was deploying apps manually using kubectl.
Problems faced
After implementing ArgoCD
Deployments became automatic
Rollbacks reduced downtime
System became stable and scalable
This is why companies adopt GitOps.
Summary
Deploying applications on Kubernetes using ArgoCD GitOps workflow makes the entire process automated, reliable, and easy to manage. Instead of manually deploying applications, you simply push changes to Git, and ArgoCD ensures your Kubernetes cluster stays updated. This approach improves deployment speed, reduces human errors, and provides complete visibility through version control. For modern DevOps engineers and developers, learning Kubernetes GitOps with ArgoCD is an essential skill for building scalable and production-ready systems.