Hands-on exercises and projects
Table of Contents
- Exercise 1: Complete installation
- Exercise 2: GitOps deployment
- Exercise 3: Multi-environment
- Exercise 4: ApplicationSet
- Final project: Complete pipeline
- Additional resources
1 - Exercise 1: Complete installation
Objective
Install Argo CD and configure it for access.
Steps
# 1. Créer un cluster (si pas existant)
minikube start --memory=4096
# ou
kind create cluster --name argocd-demo
# 2. Installer Argo CD
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
# 3. Attendre les pods
kubectl wait --for=condition=Ready pods --all -n argocd --timeout=300s
# 4. Récupérer le mot de passe
kubectl -n argocd get secret argocd-initial-admin-secret \
-o jsonpath="{.data.password}" | base64 -d && echo
# 5. Port-forward
kubectl port-forward svc/argocd-server -n argocd 8080:443 &
# 6. Se connecter
argocd login localhost:8080 --username admin --password <password> --insecure
# 7. Changer le mot de passe
argocd account update-password
Validation
- The UI is accessible at https://localhost:8080
- Successful login with admin
- Password changed
🔝 Back to table of contents
2 - Exercise 2: GitOps deployment
Objective
Deploy an application in GitOps mode.
Create the GitOps repository
# Créer un repo sur GitHub
# Structure :
gitops-demo/
└── apps/
└── nginx/
├── deployment.yaml
└── service.yaml
# apps/nginx/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
labels:
app: nginx
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.25
ports:
- containerPort: 80
# apps/nginx/service.yaml
apiVersion: v1
kind: Service
metadata:
name: nginx
spec:
selector:
app: nginx
ports:
- port: 80
targetPort: 80
Create the Argo CD application
# nginx-app.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: nginx
namespace: argocd
spec:
project: default
source:
repoURL: https://github.com/YOUR-USER/gitops-demo.git
path: apps/nginx
targetRevision: HEAD
destination:
server: https://kubernetes.default.svc
namespace: demo
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
kubectl apply -f nginx-app.yaml
Test GitOps
# Modifier replicas dans Git (2 → 3)
# Pousser le changement
# Observer dans Argo CD
argocd app get nginx
# L'application se synchronise automatiquement
🔝 Back to table of contents
3 - Exercise 3: Multi-environment
Objective
Deploy to dev and prod with Kustomize.
Structure
gitops-demo/
└── apps/
└── myapp/
├── base/
│ ├── kustomization.yaml
│ ├── deployment.yaml
│ └── service.yaml
└── overlays/
├── dev/
│ └── kustomization.yaml
└── prod/
├── kustomization.yaml
└── replicas-patch.yaml
Base
# base/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
- service.yaml
Dev Overlay
# overlays/dev/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: dev
resources:
- ../../base
Prod Overlay
# overlays/prod/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: prod
resources:
- ../../base
patches:
- path: replicas-patch.yaml
# overlays/prod/replicas-patch.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp
spec:
replicas: 5
Argo CD Applications
# myapp-dev.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: myapp-dev
namespace: argocd
spec:
project: default
source:
repoURL: https://github.com/YOUR-USER/gitops-demo.git
path: apps/myapp/overlays/dev
destination:
server: https://kubernetes.default.svc
namespace: dev
syncPolicy:
automated:
prune: true
syncOptions:
- CreateNamespace=true
---
# myapp-prod.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: myapp-prod
namespace: argocd
spec:
project: default
source:
repoURL: https://github.com/YOUR-USER/gitops-demo.git
path: apps/myapp/overlays/prod
destination:
server: https://kubernetes.default.svc
namespace: prod
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
🔝 Back to table of contents
4 - Exercise 4: ApplicationSet
Objective
Automate with ApplicationSet.
Multi-environment ApplicationSet
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: myapp-envs
namespace: argocd
spec:
generators:
- list:
elements:
- env: dev
autosync: "true"
- env: staging
autosync: "true"
- env: prod
autosync: "false"
template:
metadata:
name: 'myapp-{{env}}'
spec:
project: default
source:
repoURL: https://github.com/YOUR-USER/gitops-demo.git
path: 'apps/myapp/overlays/{{env}}'
destination:
server: https://kubernetes.default.svc
namespace: '{{env}}'
syncPolicy:
syncOptions:
- CreateNamespace=true
Verification
argocd app list
# NAME CLUSTER NAMESPACE STATUS
# myapp-dev https://kubernetes.default.svc dev Synced
# myapp-staging https://kubernetes.default.svc staging Synced
# myapp-prod https://kubernetes.default.svc prod OutOfSync
🔝 Back to table of contents
5 - Final project: Complete pipeline
Objective
Create a complete GitOps pipeline with:
- Multi-environment application
- Secrets management
- RBAC
- Notifications
Architecture
Project structure
gitops-final/
├── apps/
│ └── webapp/
│ ├── base/
│ │ ├── kustomization.yaml
│ │ ├── deployment.yaml
│ │ ├── service.yaml
│ │ └── sealed-secret.yaml
│ └── overlays/
│ ├── dev/
│ ├── staging/
│ └── prod/
├── infrastructure/
│ ├── argocd/
│ │ ├── projects.yaml
│ │ └── rbac.yaml
│ └── applicationsets/
│ └── webapp.yaml
└── README.md
Expected deliverables
- Structured GitOps repository
- AppProject with restrictions
- RBAC configured
- ApplicationSet for 3 environments
- Sealed Secret for credentials
- Documentation
🔝 Back to table of contents
6 - Additional resources
Official documentation
| Resource | URL |
|---|---|
| Argo CD Docs | https://argo-cd.readthedocs.io |
| GitHub | https://github.com/argoproj/argo-cd |
| Argo Project | https://argoproj.github.io |
Complementary tools
| Tool | Description |
|---|---|
| Argo Rollouts | Progressive deployments (canary, blue-green) |
| Argo Events | Event-driven workflows |
| Argo Workflows | Orchestration of K8s workflows |
Certifications
- Certified Kubernetes Administrator (CKA)
- Certified GitOps Associate (CGOA)
Recommended books
- "GitOps and Kubernetes" - Billy Yuen et al.
- "Kubernetes Patterns" - Bilgin Ibryam
🔝 Back to table of contents
Congratulations!
You have completed the Argo CD course! You now master:
- Installation and configuration of Argo CD
- Creating Applications (UI, CLI, YAML)
- Synchronization strategies
- ApplicationSets for automation
- Multi-cluster management
- Security and RBAC
Next steps
- Practice on personal projects
- Explore Argo Rollouts for advanced deployments
- Contribute to the Argo community
- Certify your skills (CGOA, CKA)