GitOps with Argo CD: Deploy Kubernetes Apps from Your GitHub Repo (Step-by-Step Guide)

Argo CD (Argo Continuous Delivery) is a declarative GitOps continuous delivery tool for Kubernetes. It automates the deployment of your applications by continuously monitoring your Git repositories and syncing the changes to your Kubernetes cluster.

Think of Argo CD as a Kubernetes-native tool that deploys and manages applications using Git as the single source of truth.

Learn how to install Argo CD on a Kubernetes cluster (e.g. AKS, EKS, Minikube), connect it to your GitHub repo, and automate deployments using GitOps.

Purpose of Argo CD

  • To automate Kubernetes deployments
  • To enforce consistency between Git and the live cluster
  • To enable GitOps: “If it’s in Git, it’s in Prod”

Business Use Cases for Argo CD

Use CaseDescription
GitOps DeploymentDeclarative app deployment using Git. Any Git change automatically updates the cluster.
Multi-environment PromotionPromote app versions across dev → staging → prod using Git branches or folders.
Audit & ComplianceGit history is your audit log; every deployment is traceable to a Git commit.
Disaster RecoveryRebuild entire app states from Git in minutes.
Multi-cluster ManagementManage apps across dev, test, and prod clusters from a single dashboard.
Developer Self-ServiceDevelopers push to Git, and Argo CD auto-deploys, reducing dependency on ops.
Kubernetes at ScaleManage hundreds of microservices with ApplicationSets and sync waves.

When Should You Use Argo CD?

You should consider Argo CD when:

✅ You’re running Kubernetes in dev/stage/prod
✅ You want GitOps workflows (Git = source of truth)
✅ You need repeatable, auditable deployments
✅ You want to avoid manual kubectl apply operations
✅ You have multiple clusters or microservices
✅ You want to roll back easily to previous versions
✅ You need automated deployment and health checks

Key Benefits of Using Argo CD

1. True GitOps Experience

  • Git drives the desired state
  • Auto-sync to apply changes

2. Visual Dashboard

  • See health & sync status of apps
  • View diffs between Git and cluster

3. Audit and Compliance

  • Every deployment tied to a Git commit
  • Easy rollback using Git history

4. Developer Autonomy

  • Developers commit YAML, Argo CD deploys
  • No need for CI/CD pipelines to manage deployment

5. Self-Healing

  • Detects and fixes drift from desired state automatically

6. Supports Helm, Kustomize, Jsonnet, YAML

  • Flexibility in how you define your apps

7. Multi-cluster Support

  • Deploy and manage apps across clusters with a single Argo CD instance

Real-World Example

A fintech company has separate environments (dev/stage/prod) and dozens of microservices.
They use:

  • Git branches for each environment
  • Argo CD to automatically sync those branches to the corresponding cluster
  • All changes are auditable and rollback is easy via Git

Prerequisites

  • ✅ Kubernetes Cluster (AKS, EKS, Minikube, etc.)
  • kubectl installed and connected
  • argocd CLI (optional but useful)
  • ✅ GitHub Account
  • ✅ Basic Kubernetes YAMLs (Deployment, Service)

Objectives

  • Create an AKS Cluster
  • Install Argo CD in the cluster
  • Expose Argo CD for web access
  • Retrieve the admin password
  • Deploy and manage a Kubernetes workload (jaganrajagopaljenkinswithdockercomposeup)
  • Simulate GitOps changes (scaling and image updates)

Please refer this offical document :Installation – Argo CD – Declarative GitOps CD for Kubernetes

Step 1: Create Azure Resource Group

Please login into Azure cloud using azure cli commands -> az login

az login 
az group create --name argocicd --location eastus

Creates a resource group named argocicd in the East US region.

Step 2: Create AKS Cluster

az aks create \
  --resource-group argocicd \
  --name aksargocd \
  --node-count 1 \
  --node-vm-size Standard_B2s \
  --generate-ssh-keys

This will merge the cluster credentials into your kubectl config.

Step 4: Install Argo CD in the Cluster

Create a namespace and apply the official Argo CD manifests:

kubectl create namespace argocd

kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml

Step 5: Expose Argo CD via LoadBalancer

Change service type so Argo CD is accessible externally:

kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'

Check for external IP:

kubectl get svc argocd-server -n argocd

Access Argo CD Web UI

Open the Argo CD console in your browser using your LoadBalancer or port-forwarding setup.

If using port-forwarding:

kubectl port-forward svc/argocd-server -n argocd 8080:443

Step 6: Get Initial Admin Password

kubectl get secret argocd-initial-admin-secret \
  -n argocd \
  -o jsonpath="{.data.password}" | base64 -d && echo

Example output

p7MGx7YTxxx2tI2ZzEu

Login to the UI

  • Username: admin
  • Password: (the decoded value you just got)

Use username admin and the above password to log in to the Argo CD UI.

Argo CD UI Dashboard

Step 7: Deploy Your Application to AKS

Let’s say you already deployed a workload named jaganrajagopaljenkinswithdockercomposeup.

MyGit Repo Link: Jenkinswithdockercomposeup/manifests at master · jaganrajagopal/Jenkinswithdockercomposeup

You can manage it using kubectl or GitOps via Argo CD.

Step 8: Simulate Out-of-Sync (Manual Change)

Scale the deployment manually:

kubectl scale deployment jaganrajagopaljenkinswithdockercomposeup --replicas=3

Change the image manually (out of sync from Git):

kubectl set image deployment/jaganrajagopaljenkinswithdockercomposeup jaganrajagopaljenkinswithdockercomposeup=nginx:latest -n dev

Argo CD will detect this drift and show the application as OutOfSync.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *