Hands-on Lab

#Lab: GitOps with ArgoCD

Set up GitOps deployment with ArgoCD.

#🎯 Objectives

  • Install ArgoCD
  • Connect Git repository
  • Deploy application

#Task 1: Install ArgoCD

bash
1kubectl create namespace argocd
2kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
3
4# Expose UI
5kubectl port-forward svc/argocd-server -n argocd 8080:443
6
7# Get password
8kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d

#Task 2: Create Application

yaml
1# argocd-app.yaml
2apiVersion: argoproj.io/v1alpha1
3kind: Application
4metadata:
5  name: myapp
6  namespace: argocd
7spec:
8  project: default
9  source:
10    repoURL: https://github.com/your/repo.git
11    targetRevision: HEAD
12    path: k8s
13  destination:
14    server: https://kubernetes.default.svc
15    namespace: default
16  syncPolicy:
17    automated:
18      prune: true
19      selfHeal: true
bash
kubectl apply -f argocd-app.yaml

#Task 3: Make Change

  1. Edit manifest in Git
  2. Commit and push
  3. Watch ArgoCD auto-sync

#✅ Success Criteria

  • ArgoCD UI accessible
  • App synced from Git
  • Changes auto-deploy