Aller au contenu principal

Lab 12.3 - GitOps avec ArgoCD

Objectifs du Lab

À la fin de ce lab, vous serez capable de:

  • Installer ArgoCD dans Kubernetes.
  • Comprendre le concept GitOps.
  • Configurer un repository Git comme source.
  • Déployer une application avec ArgoCD.
  • Synchroniser les déploiements.

Durée Estimée

60-75 minutes

Prérequis

  • kubectl installé et configuré.
  • Cluster Kubernetes local fonctionnel.
  • Un repository Git (optionnel, peut utiliser un repo local).

Partie 1: Installation d'ArgoCD

Étape 1.1: Installer ArgoCD

kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml

Attendez que les Pods soient prêts:

kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=argocd-server -n argocd --timeout=300s

Partie 2: Accès à ArgoCD

Étape 2.1: Obtenir le Mot de Passe Admin

kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d

Étape 2.2: Port-Forward

kubectl port-forward svc/argocd-server -n argocd 8080:443

Accédez à https://localhost:8080 (acceptez le certificat auto-signé).

Connectez-vous avec:

  • Username: admin
  • Password: (celui obtenu à l'étape précédente)

Partie 3: Configuration d'une Application

Étape 3.1: Créer une Application via CLI

Créez une application ArgoCD:

argocd app create my-app \
--repo https://github.com/example/repo.git \
--path manifests \
--dest-server https://kubernetes.default.svc \
--dest-namespace default

Étape 3.2: Synchroniser

argocd app sync my-app

Résumé du Lab

Dans ce lab, vous avez installé ArgoCD et configuré une application GitOps. Vous avez appris les concepts de base de GitOps.


Prochaines Étapes

Le dernier lab de ce module est le projet final complet.

Lab 12.4: Projet Final Complet


Lab créé le: Décembre 2024