Lab 12.3 - GitOps with ArgoCD
Lab Objectives
By the end of this lab, you will be able to:
- Install ArgoCD in Kubernetes.
- Understand the GitOps concept.
- Configure a Git repository as a source.
- Deploy an application with ArgoCD.
- Synchronize deployments.
Estimated Duration
60-75 minutes
Prerequisites
- kubectl installed and configured.
- Working local Kubernetes cluster.
- A Git repository (optional, can use a local repo).
Part 1: Installing ArgoCD
Step 1.1: Install ArgoCD
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
Wait for the Pods to be ready:
kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=argocd-server -n argocd --timeout=300s
Part 2: Accessing ArgoCD
Step 2.1: Get the Admin Password
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d
Step 2.2: Port-Forward
kubectl port-forward svc/argocd-server -n argocd 8080:443
Access https://localhost:8080 (accept the self-signed certificate).
Log in with:
- Username:
admin - Password: (the one obtained in the previous step)
Part 3: Configuring an Application
Step 3.1: Create an Application via CLI
Create an ArgoCD application:
argocd app create my-app \
--repo https://github.com/example/repo.git \
--path manifests \
--dest-server https://kubernetes.default.svc \
--dest-namespace default
Step 3.2: Synchronize
argocd app sync my-app
Lab Summary
In this lab, you installed ArgoCD and configured a GitOps application. You learned the basic concepts of GitOps.
Next Steps
The final lab of this module is the complete final project.
Lab 12.4: Complete Final Project
Lab created on: December 2024