ArgoCD GitOps Tutorial 2025 - Continuous Deployment
🚀 Why ArgoCD in 2025?
ArgoCD leads the GitOps revolution with 65% enterprise adoption. It automates Kubernetes deployments using Git as the single source of truth - ensuring consistency, auditability, and faster deployments.
Quick Facts:
- ✅ 80% faster deployment cycles
- ✅ Zero-downtime rolling updates
- ✅ Salary Impact: GitOps skills add ₹8-20 LPA
- ✅ 65% adoption in enterprise Kubernetes environments
- ✅ Git as source of truth - complete audit trail
- ✅ CNCF Graduated project - production-ready
📦 Quick Installation
Method 1: Using Helm (Recommended)
# Add ArgoCD Helm repository
helm repo add argo https://argoproj.github.io/argo-helm
helm repo update
# Install ArgoCD
helm install argocd argo/argo-cd \
--namespace argocd \
--create-namespace \
--set server.service.type=LoadBalancer
# Verify installation
kubectl get pods -n argocd
kubectl get svc -n argocdMethod 2: Using kubectl
# Install ArgoCD
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
# Wait for pods to be ready
kubectl wait --for=condition=Ready pods --all -n argocd --timeout=300sAccess ArgoCD UI:
# Port forward to access UI
kubectl port-forward svc/argocd-server -n argocd 8080:443
# Or expose via LoadBalancer
kubectl patch svc argocd-server -n argocd -p '{ "spec": { "type": "LoadBalancer" } }'Login Credentials:
- 🌐 URL:
https://localhost:8080 - 👤 Username:
admin - 🔑 Get Password:
# Get initial admin password
kubectl -n argocd get secret argocd-initial-admin-secret \
-o jsonpath="{ .data.password }" | base64 -d; echo
# Install ArgoCD CLI
curl -sSL -o argocd-linux-amd64 https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64
sudo install -m 555 argocd-linux-amd64 /usr/local/bin/argocd
# Login via CLI
argocd login localhost:8080 --username admin --password <password>🎯 Core Concepts
📦 Application
A group of Kubernetes resources defined in a Git repository. ArgoCD continuously monitors and syncs these resources to your cluster.
🔄 Sync Policy
Defines how ArgoCD deploys changes - automated (instant) or manual (approval required). Includes self-heal and prune options.
💚 Health Status
Real-time health of deployed resources: Healthy, Progressing, Degraded, Suspended, Missing, or Unknown.
🔍 Sync Status
Comparison between Git (desired state) and cluster (actual state): Synced, OutOfSync, or Unknown.
Additional Key Concepts:
- ✅ Project: Logical grouping of applications with RBAC
- ✅ Repository: Git repo containing Kubernetes manifests
- ✅ Cluster: Target Kubernetes cluster for deployment
- ✅ Sync Wave: Control deployment order with annotations
- ✅ Resource Hook: Execute actions during sync (PreSync, Sync, PostSync)
- ✅ ApplicationSet: Template for creating multiple applications
📁 Your First Application
Create Application YAML (app.yaml):
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: myapp
namespace: argocd
# Finalizer ensures proper cleanup
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
# Project for RBAC
project: default
# Source repository
source:
repoURL: https://github.com/your-repo/manifests.git
targetRevision: main
path: k8s/
# For Helm charts
# helm:
# valueFiles:
# - values.yaml
# For Kustomize
# kustomize:
# namePrefix: prod-
# Destination cluster and namespace
destination:
server: https://kubernetes.default.svc
namespace: production
# Sync policy
syncPolicy:
automated:
prune: true # Delete resources not in Git
selfHeal: true # Auto-sync on drift
allowEmpty: false # Prevent empty sync
syncOptions:
- CreateNamespace=true # Auto-create namespace
- PruneLast=true # Prune after sync
retry:
limit: 5
backoff:
duration: 5s
factor: 2
maxDuration: 3m# Apply the application
kubectl apply -f app.yaml
# Or create via ArgoCD CLI
argocd app create myapp \
--repo https://github.com/your-repo/manifests.git \
--path k8s \
--dest-server https://kubernetes.default.svc \
--dest-namespace production \
--sync-policy automated \
--auto-prune \
--self-heal
# Check application status
argocd app get myapp
argocd app sync myapp🔄 GitOps Workflow
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Developer │ ───▶ │ Git Commit │ ───▶ │ArgoCD Detects│
│ Makes Change │ │ Push Code │ │ Changes │
└──────────────┘ └──────────────┘ └──────────────┘
│
▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Application │ ◀─── │ Applies │ ◀─── │ Compares │
│ Deployed │ │ Changes │ │ Git vs K8s │
└──────────────┘ └──────────────┘ └──────────────┘
│
▼
┌──────────────────────────────────────────────────────────┐
│ Continuous Monitoring & Sync │
│ • Health Checks • Drift Detection • Auto-Healing │
└──────────────────────────────────────────────────────────┘GitOps Benefits:
For Developers:
- ✅ Git as deployment interface
- ✅ No kubectl access needed
- ✅ Easy rollbacks via Git revert
- ✅ Complete audit trail
For Operations:
- ✅ Declarative infrastructure
- ✅ Automated drift correction
- ✅ Disaster recovery via Git
- ✅ Multi-cluster consistency
🛠️ Essential Commands
argocd app list # List applications
argocd app get myapp # View application details
argocd app sync myapp # Manual sync
argocd app history myapp # Deployment history
argocd app rollback myapp # Rollback to previous version
argocd repo add https://github.com/your-repo # Add Git repo📊 Real Example: Multi-Environment
staging-app.yaml:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: myapp-staging
spec:
source:
repoURL: https://github.com/your-repo.git
path: k8s/overlays/staging
targetRevision: main
destination:
namespace: staging
syncPolicy:
automated: {}production-app.yaml:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: myapp-production
spec:
source:
repoURL: https://github.com/your-repo.git
path: k8s/overlays/production
targetRevision: main
destination:
namespace: production
syncPolicy:
automated:
selfHeal: true
prune: true🔐 Security Best Practices
1. RBAC Configuration:
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
name: production-project
spec:
sourceRepos:
- 'https://github.com/your-org/*'
destinations:
- namespace: production
server: https://kubernetes.default.svc
roles:
- name: dev-team
policies:
- p, proj:production-project:dev-team, applications, get, production-project/*, allow2. Use SSO Integration:
- Configure OAuth2 (GitHub, GitLab, Google)
- Enable RBAC with group policies
- Audit logs enabled
🔔 Notifications & Webhooks
apiVersion: argoproj.io/v1alpha1
kind: ConfigMap
metadata:
name: argocd-notifications-cm
data:
service.slack: |
token: $slack-token
trigger.on-sync-succeeded: |
- send: [slack]
template.app-sync-succeeded: |
message: |
Application {{ .app.metadata.name }} sync succeeded📈 Advanced Features 2025
1. ApplicationSet (Multi-cluster):
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: cluster-apps
spec:
generators:
- clusters:
selector:
matchLabels:
env: production
template:
metadata:
name: '{{ name }} -app'
spec:
project: default
source:
repoURL: https://github.com/your-repo.git
targetRevision: main
path: k8s/
destination:
server: '{{ server }} '
namespace: default2. Health Checks:
spec:
syncPolicy:
syncOptions:
- Validate=true🛠️ Essential ArgoCD Commands
Common CLI Commands:
# Application Management
argocd app list # List all applications
argocd app get myapp # View application details
argocd app sync myapp # Manual sync
argocd app sync myapp --prune # Sync and prune
argocd app diff myapp # Show differences
argocd app history myapp # Deployment history
argocd app rollback myapp 5 # Rollback to revision 5
argocd app delete myapp # Delete application
# Repository Management
argocd repo add https://github.com/your-repo # Add Git repo
argocd repo list # List repositories
# Cluster Management
argocd cluster add my-cluster # Add cluster
argocd cluster list # List clusters
# Project Management
argocd proj create myproject # Create project
argocd proj list # List projects
# Monitoring
argocd app logs myapp # View application logs
argocd app wait myapp # Wait for sync completion
argocd app manifests myapp # View generated manifests💡 Pro Tips 2025
Best Practices:
- ✅ Use Kustomize/Helm: Manage environment-specific configs efficiently
- ✅ Enable auto-pruning: Clean up removed resources automatically
- ✅ Set resource hooks: Execute database migrations during sync
- ✅ Use sync waves: Control deployment order with annotations
- ✅ App of Apps pattern: Manage multiple applications as one
- ✅ Implement RBAC: Use projects for team isolation
- ✅ Enable notifications: Get alerts on Slack/Teams
- ✅ Use ApplicationSets: Template applications for multi-cluster
- ✅ Git branch strategy: Use branches for environments
- ✅ Health checks: Define custom health checks for CRDs
- ✅ Backup regularly: Export application definitions
- ✅ Monitor metrics: Use Prometheus for ArgoCD metrics
🚨 Troubleshooting Guide
Common Issues & Solutions:
❌ Sync Failed
Cause: Invalid manifest syntax or missing resources
Solution: Check manifest syntax, validate YAML, review error logs
⚠️ Health Degraded
Cause: Pods not running, failed health checks
Solution: Check pod status, review events, verify resource limits
🔄 OutOfSync
Cause: Git state differs from cluster state
Solution: Run sync, enable auto-sync, check for manual changes
🔒 Access Denied
Cause: Insufficient RBAC permissions
Solution: Check project permissions, verify service account, review RBAC policies
Debug Commands:
# Show differences between Git and cluster
argocd app diff myapp
# View generated manifests
argocd app manifests myapp
# View application logs
argocd app logs myapp
# Get detailed application info
argocd app get myapp --show-params
# Check sync status
kubectl get application myapp -n argocd -o yaml
# View ArgoCD server logs
kubectl logs -n argocd deployment/argocd-server
# View application controller logs
kubectl logs -n argocd deployment/argocd-application-controller📚 4-Week Learning Path
Week 1: Basics & Installation
- ✅ Install ArgoCD on Kubernetes cluster
- ✅ Understand GitOps principles
- ✅ Navigate ArgoCD UI
- ✅ Connect first Git repository
- ✅ Project: Deploy simple Nginx application
Week 2: Application Management
- ✅ Create applications via UI and YAML
- ✅ Configure sync policies (auto/manual)
- ✅ Use Kustomize and Helm charts
- ✅ Monitor health and sync status
- ✅ Project: Deploy microservices application
Week 3: Multi-Environment Setup
- ✅ Set up dev, staging, production environments
- ✅ Use Kustomize overlays for environment configs
- ✅ Implement promotion workflows
- ✅ Configure RBAC and projects
- ✅ Project: Complete CI/CD pipeline with GitOps
Week 4: Advanced Patterns & Production
- ✅ ApplicationSets for multi-cluster
- ✅ Sync waves and resource hooks
- ✅ Notifications and webhooks
- ✅ Security best practices and SSO
- ✅ Disaster recovery and backup
- ✅ Project: Production-grade multi-cluster setup
💼 Career Impact 2025
Junior DevOps Engineer
Salary: ₹12-18 LPA
Skills: Basic ArgoCD setup, application deployment, Git workflows
Mid-Level SRE/Platform Engineer
Salary: ₹20-35 LPA
Skills: Multi-environment setup, RBAC, ApplicationSets, advanced sync policies
Senior/Architect
Salary: ₹35-55 LPA
Skills: Multi-cluster GitOps, platform engineering, security architecture, disaster recovery
✅ Quick Start Checklist
Week 1-2:
- ☐ Install ArgoCD on Kubernetes cluster
- ☐ Access ArgoCD UI and CLI
- ☐ Connect Git repository
- ☐ Deploy first application
- ☐ Understand sync status
Week 3-4:
- ☐ Configure auto-sync policies
- ☐ Set up multi-environment
- ☐ Implement RBAC and projects
- ☐ Configure notifications
- ☐ Build production GitOps workflow
Begin GitOps: Your first git push deploys to production!
Remember: Git is now your deployment button. Commit to deploy!
🚀 Ready to Master ArgoCD, GitOps & DevOps?
Join our DevOps Master Program with hands-on ArgoCD and GitOps training
✅ Hands-on Projects • ✅ Industry Mentors • ✅ 100% Placement Assistance • ✅ Certification Prep
🎓 Next Batch Starts: December 13, 2025
Only 15 seats remaining!