Time to install the engine of GitOps. ArgoCD runs inside your cluster, watches your Git repo, and keeps the cluster in sync. This lesson gets it running and explains what each component does.
ArgoCD Architecture
🏋️ Install ArgoCD on AKS
# Ensure connected to your AKS cluster
az aks get-credentials --resource-group rg-cicd-mastery --name aks-cicd-mastery
# Create namespace
kubectl create namespace argocd
# Install ArgoCD
kubectl apply -n argocd -f \
https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
# Wait for ready (~2 minutes)
kubectl wait --for=condition=available deployment/argocd-server \
-n argocd --timeout=300s
# Check pods
kubectl get pods -n argocd
# Should show: argocd-server, argocd-repo-server, argocd-application-controller, argocd-redis
Access the UI
# Port-forward (for learning — use Ingress in production)
kubectl port-forward svc/argocd-server -n argocd 8080:443 &
# Get the initial admin password
ARGO_PASS=$(kubectl -n argocd get secret argocd-initial-admin-secret \
-o jsonpath="{.data.password}" | base64 -d)
echo "Password: $ARGO_PASS"
# Open: https://localhost:8080
# Login: admin / $ARGO_PASS
Install the CLI
# macOS
brew install argocd
# Linux
curl -sSL -o argocd https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64
chmod +x argocd && sudo mv argocd /usr/local/bin/
# Login
argocd login localhost:8080 --username admin --password $ARGO_PASS --insecure
🏋️ Create the GitOps Repository
# Create a new repo for GitOps config
mkdir cicd-mastery-gitops && cd cicd-mastery-gitops
git init
# Create the structure
mkdir -p base environments/staging environments/production apps
# We'll populate these in the next lesson
echo "# GitOps Configuration" > README.md
git add . && git commit -m "init: GitOps repo structure"
# Push to GitHub
gh repo create cicd-mastery-gitops --public --source=. --push
Key CLI Commands
| Command | Purpose |
|---|---|
argocd app list | See all managed applications |
argocd app get <name> | Detailed status of one app |
argocd app sync <name> | Force sync (deploy) now |
argocd app diff <name> | Show what WOULD change |
argocd app history <name> | Deployment history |
argocd app rollback <name> <rev> | Rollback to revision |
Application States
🧠 Recall Check
- Which ArgoCD component actually compares Git vs cluster and syncs?
- How often does ArgoCD poll Git by default? How can you make it faster?
- What does "OutOfSync" mean?
- Where does ArgoCD run?
Reveal answers
- The Application Controller. It's the brain — watches apps, diffs desired vs actual, triggers syncs.
- Every 3 minutes. For instant detection, configure a GitHub webhook pointing to ArgoCD's
/api/webhookendpoint. - Git has changes that aren't yet applied to the cluster. The desired state (Git) doesn't match the actual state (cluster).
- Inside your Kubernetes cluster, in its own namespace (
argocd). This is why it doesn't need external credentials — it's already in the cluster.
ArgoCD is running. Your GitOps repo exists. Next lesson: creating your first ArgoCD Application — connecting a Git path to a K8s namespace, with sync policies that control how and when changes are applied.