Skip to main content

Hands-on exercises and projects


Table of Contents

  1. Exercise 1: Complete installation
  2. Exercise 2: GitOps deployment
  3. Exercise 3: Multi-environment
  4. Exercise 4: ApplicationSet
  5. Final project: Complete pipeline
  6. 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

🔝 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

ResourceURL
Argo CD Docshttps://argo-cd.readthedocs.io
GitHubhttps://github.com/argoproj/argo-cd
Argo Projecthttps://argoproj.github.io

Complementary tools

ToolDescription
Argo RolloutsProgressive deployments (canary, blue-green)
Argo EventsEvent-driven workflows
Argo WorkflowsOrchestration of K8s workflows

Certifications

  • Certified Kubernetes Administrator (CKA)
  • Certified GitOps Associate (CGOA)
  • "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

  1. Practice on personal projects
  2. Explore Argo Rollouts for advanced deployments
  3. Contribute to the Argo community
  4. Certify your skills (CGOA, CKA)

← Back to the course table of contents