1 h 30 (S4.1 : 45 min · S4.2 : 45 min)
M03 terminé (projet flotte, dépôt flotte-config connecté)
premier déploiement de flotte-web par ArgoCD
flotte-web et les pousser dans GitApplication déclarative conforme au projet flotteapp diff)45 min
flotte-webApplication = Source (dépôt + révision + chemin) + Destination (cluster + namespace) + Projetflowchart LR Git["flotte-config<br/>apps/flotte-web"] --> App["Application<br/>flotte-web-dev"] App --> K8s["Cluster<br/>namespace flotte-dev"] Proj["AppProject<br/>flotte"] -.-> App
argocdflotte-web
flotte-config/apps/flotte-web/| Fichier | Ressource | Rôle |
|---|---|---|
deployment.yaml |
Deployment | 2 réplicas de podinfo:6.15.0, sondes, ressources |
service.yaml |
Service | Port 80 → port http (9898) |
configmap.yaml |
ConfigMap | Message et couleur de l'UI |
kubectl apply --dry-run=server -n default -f apps/flotte-web/Sortie attendue :
configmap/flotte-web-config created (server dry run)
deployment.apps/flotte-web created (server dry run)
service/flotte-web created (server dry run)flotte-config/argocd/flotte-web-dev.yamlapiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: flotte-web-dev
namespace: argocd
finalizers: [resources-finalizer.argocd.argoproj.io]
spec:
project: flotte
source: {repoURL: "https://gitlab.com/<GITLAB_USER>/flotte-config.git",
targetRevision: main, path: apps/flotte-web}
destination: {server: "https://kubernetes.default.svc", namespace: flotte-dev}
syncPolicy: {syncOptions: [CreateNamespace=true]}| Champ | Exemple | Contrôle |
|---|---|---|
spec.project |
flotte |
RBAC + règles du projet |
source.repoURL |
URL de flotte-config |
Dans sourceRepos du projet |
source.targetRevision |
main |
Branche, tag ou commit existant |
source.path |
apps/flotte-web |
Dossier existant dans la révision |
destination.server / name |
https://kubernetes.default.svc |
Cluster déclaré |
destination.namespace |
flotte-dev |
Motif flotte-* du projet |
targetRevision décide de ce qui est déployé| Valeur | Exemple | Effet |
|---|---|---|
| Branche | main |
Suit chaque nouveau commit |
| Tag | v1.4.0 |
Figé jusqu'au changement du tag suivi |
| Commit | 05b6219 |
Figé, reproductible |
HEAD |
HEAD |
Branche par défaut du dépôt |
branche pour dev, tag ou commit pour prod (M09)
| Méthode | Commande | Trace dans Git |
|---|---|---|
| UI | + New App | Non |
| CLI | argocd app create <NOM> --repo <URL> --path <CHEMIN> |
Non |
| Déclarative | kubectl apply -f argocd/flotte-web-dev.yaml |
Oui |
création UI réservée aux essais ; production = YAML dans Git
OutOfSync / Missing : rien n'existe encore dans le clusterkubectl apply -f argocd/flotte-web-dev.yaml
argocd app get flotte-web-dev
argocd app diff flotte-web-devSortie attendue (extrait de app get) :
Sync Status: OutOfSync from main (ef64ceb)
Health Status: Missing
GROUP KIND NAMESPACE NAME STATUS HEALTH HOOK MESSAGE
ConfigMap flotte-dev flotte-web-config OutOfSync Missing
Service flotte-dev flotte-web OutOfSync Missing
apps Deployment flotte-dev flotte-web OutOfSync Missingargocd app sync flotte-web-dev
argocd app wait flotte-web-dev --health
kubectl get deploy -n flotte-devSortie attendue (extrait) :
Sync Status: Synced to main (ef64ceb)
Health Status: Healthy
NAME READY UP-TO-DATE AVAILABLE AGE
flotte-web 2/2 2 2 20sargocd.argoproj.io/tracking-id (suivi 3.x)argocd app delete supprime aussi les ressources (cascade)45 min
repo-server| Contenu du chemin | Type détecté | Module |
|---|---|---|
Chart.yaml |
Helm | M09 |
kustomization.yaml |
Kustomize | M09 |
Fichiers .yaml, .yml, .json, .jsonnet |
Répertoire (Directory) | M04 |
chart), plugin de configurationflowchart LR Src["Source Git<br/>ou chart"] --> Repo["repo-server<br/>rendu"] Repo --> Yaml["Manifestes<br/>YAML finaux"]
source:
repoURL: https://gitlab.com/<GITLAB_USER>/flotte-config.git
path: apps/flotte-web
directory:
recurse: true
exclude: "{*.md,tests/*}"recurse : sous-dossiers ignorésinclude / exclude : motifs glob, accolades pour plusieurs motifsmanifeste rangé dans un sous-dossier sans recurse: true = jamais déployé, sans erreur
source:
repoURL: https://stefanprodan.github.io/podinfo
chart: podinfo
targetRevision: 6.16.0
helm:
releaseName: flotte-web
valuesObject:
replicaCount: 1
ui: {message: "Hexa Mobilite - apercu Helm"}targetRevision = version du chart (pas une branche)helm template) : aucun helm install, helm list videsource:
repoURL: https://github.com/stefanprodan/podinfo.git
targetRevision: 6.17.0
path: kustomizekustomization.yaml présent dans path → Kustomize appliquékustomize.images, namePrefix, commonLabelsAvant: une copie des manifestes par environnement (dérive entre copies)
Après: base/ + overlays/dev, overlays/prod (écarts explicites)
argocd app manifests flotte-web-helm --source git | grep -E '^kind:|image:'Sortie attendue :
kind: Service
kind: Deployment
image: ghcr.io/stefanprodan/podinfo:6.16.0--source git : rendu depuis Git ; --source live : état du clusterargocd app get <APP> -o yaml (champ status.summary.images)6.15.0), jamais latest (aucun changement détectable dans Git)readinessProbe / livenessProbe : la santé ArgoCD en dépendrequests / limits déclarésapp.kubernetes.io/name, part-of)namespace en dur : fourni par la destinationkubectl apply : Applications déclaratives et reconstructiblesargocd app diff avant toute synchronisationtargetRevision : branche (suivi), tag ou commit (figé)Application ?flotte-dev)argocddefaultkube-systemargocd ; flotte-dev est sa destination.Synced / HealthyOutOfSync / MissingUnknown / DegradedSynced / MissingOutOfSync (écart avec Git) et Missing (santé).targetRevision suit chaque nouveau commit ?v1.4.0main6.16.0Chart.yamlhelm/.tgz obligatoirerepo-server détecte Helm à la présence de Chart.yaml.resources-finalizer.argocd.argoproj.io ?latest en GitOps ?latest : nouvelle image sans modification de Git, donc ni écart détecté ni historique.argocd app manifests <APP> --source gitkubectl get <APP> -o yamlhelm listargocd repo get <URL>argocd app manifests <APP> --source git affiche le rendu des manifestes depuis Git.