#Lab: ArgoCD Application Deployment
Implement GitOps with ArgoCD.
#๐ฏ Objectives
- Install ArgoCD in Kubernetes
- Deploy applications declaratively
- Sync and manage applications
#๐ Prerequisites
- Kubernetes cluster
- kubectl configured
#โฑ๏ธ Duration: 30 minutes
#Task 1: Install ArgoCD (5 min)
bash
1# Create namespace
2kubectl create namespace argocd
3
4# Install ArgoCD
5kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
6
7# Wait for pods
8kubectl wait --for=condition=Ready pods --all -n argocd --timeout=300s
9
10# Get initial admin password
11kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d#Task 2: Access ArgoCD UI (5 min)
bash
1# Port forward
2kubectl port-forward svc/argocd-server -n argocd 8080:443 &
3
4# Open https://localhost:8080
5# Login: admin / <password from step 1>#Install CLI (optional)
bash
1# Linux
2curl -sSL -o argocd-linux-amd64 https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64
3sudo install -m 555 argocd-linux-amd64 /usr/local/bin/argocd
4
5# Login
6argocd login localhost:8080#Task 3: Create Application (10 min)
#Via CLI
bash
1argocd app create guestbook \
2 --repo https://github.com/argoproj/argocd-example-apps.git \
3 --path guestbook \
4 --dest-server https://kubernetes.default.svc \
5 --dest-namespace default#Via Manifest
yaml
1apiVersion: argoproj.io/v1alpha1
2kind: Application
3metadata:
4 name: myapp
5 namespace: argocd
6spec:
7 project: default
8 source:
9 repoURL: https://github.com/argoproj/argocd-example-apps.git
10 targetRevision: HEAD
11 path: guestbook
12 destination:
13 server: https://kubernetes.default.svc
14 namespace: default
15 syncPolicy:
16 automated:
17 prune: true
18 selfHeal: truebash
kubectl apply -f application.yaml#Task 4: Sync and Manage (10 min)
bash
1# View applications
2argocd app list
3kubectl get applications -n argocd
4
5# Sync application
6argocd app sync guestbook
7
8# Get app details
9argocd app get guestbook
10
11# View history
12argocd app history guestbook
13
14# Rollback
15argocd app rollback guestbook <revision>
16
17# Delete
18argocd app delete guestbook#โ Success Criteria
- ArgoCD installed and accessible
- Application created from Git
- Application synced successfully
- Apps visible in UI
#๐งน Cleanup
bash
kubectl delete namespace argocd