Aller au contenu principal

Interface Web et CLI


Table des matières

  1. Interface Web
  2. CLI argocd
  3. Commandes essentielles
  4. Notifications
  5. Exercices pratiques

1 - Interface Web

Accès

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

# Ouvrir https://localhost:8080
# Login: admin / <password>

Pages principales

PageDescription
ApplicationsListe de toutes les apps
SettingsConfiguration, repos, clusters
User InfoProfil et tokens

Vue Application

L'interface affiche :

  • Sync Status : Synced, OutOfSync
  • Health Status : Healthy, Degraded, Progressing
  • Resource Tree : Hiérarchie des ressources K8s
  • Diff : Différences entre Git et cluster

Actions disponibles

ActionDescription
SYNCSynchroniser avec Git
REFRESHRecharger depuis Git
ROLLBACKRevenir à une version
DELETESupprimer l'application

Filtres et recherche

# Filtrer par projet
project:production

# Filtrer par status
status:OutOfSync

# Filtrer par label
label:team=backend

🔝 Retour à la table des matières


2 - CLI argocd

Installation

# macOS
brew install argocd

# Linux
VERSION=$(curl -s https://api.github.com/repos/argoproj/argo-cd/releases/latest | grep tag_name | cut -d '"' -f 4)
curl -sSL -o argocd https://github.com/argoproj/argo-cd/releases/download/$VERSION/argocd-linux-amd64
sudo install -m 555 argocd /usr/local/bin/argocd

# Windows
choco install argocd-cli

Connexion

# Login interactif
argocd login localhost:8080

# Login avec credentials
argocd login localhost:8080 \
--username admin \
--password <password> \
--insecure

# Login avec token
argocd login localhost:8080 \
--auth-token <token>

# Vérifier
argocd version

Configuration

# Voir le contexte actuel
argocd context

# Lister les contextes
argocd context

# Changer de contexte
argocd context my-argocd-server

🔝 Retour à la table des matières


3 - Commandes essentielles

Applications

# Lister
argocd app list

# Créer
argocd app create my-app \
--repo https://github.com/org/repo.git \
--path apps/my-app \
--dest-server https://kubernetes.default.svc \
--dest-namespace default

# Détail
argocd app get my-app

# Synchroniser
argocd app sync my-app

# Synchroniser avec options
argocd app sync my-app --prune --force

# Historique
argocd app history my-app

# Rollback
argocd app rollback my-app 3

# Supprimer
argocd app delete my-app

# Supprimer avec les ressources
argocd app delete my-app --cascade

Repositories

# Lister
argocd repo list

# Ajouter (HTTPS)
argocd repo add https://github.com/org/repo.git \
--username git \
--password <token>

# Ajouter (SSH)
argocd repo add [email protected]:org/repo.git \
--ssh-private-key-path ~/.ssh/id_rsa

# Supprimer
argocd repo rm https://github.com/org/repo.git

Clusters

# Lister
argocd cluster list

# Ajouter
argocd cluster add my-cluster-context

# Supprimer
argocd cluster rm https://my-cluster.example.com

Projects

# Lister
argocd proj list

# Créer
argocd proj create production \
--dest https://kubernetes.default.svc,production \
--src https://github.com/org/gitops.git

# Détail
argocd proj get production

Comptes

# Lister les comptes
argocd account list

# Changer le mot de passe
argocd account update-password

# Générer un token
argocd account generate-token --account admin

🔝 Retour à la table des matières


4 - Notifications

Installation

kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj-labs/argocd-notifications/stable/manifests/install.yaml

Configuration Slack

apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-notifications-cm
namespace: argocd
data:
service.slack: |
token: $slack-token

template.app-deployed: |
message: |
Application {{.app.metadata.name}} has been deployed.
Sync Status: {{.app.status.sync.status}}
Health Status: {{.app.status.health.status}}

trigger.on-deployed: |
- when: app.status.sync.status == 'Synced'
send: [app-deployed]

Annoter une application

metadata:
annotations:
notifications.argoproj.io/subscribe.on-deployed.slack: my-channel

Triggers disponibles

TriggerDescription
on-deployedAprès sync réussi
on-health-degradedSanté dégradée
on-sync-failedÉchec de sync
on-sync-runningSync en cours
on-sync-status-unknownStatus inconnu

🔝 Retour à la table des matières


5 - Exercices pratiques

Exercice 1 : Workflow complet CLI

# 1. Se connecter
argocd login localhost:8080 --username admin --password <password>

# 2. Créer une application
argocd app create demo \
--repo https://github.com/argoproj/argocd-example-apps.git \
--path guestbook \
--dest-server https://kubernetes.default.svc \
--dest-namespace demo

# 3. Vérifier le status
argocd app get demo

# 4. Synchroniser
argocd app sync demo

# 5. Voir l'historique
argocd app history demo

# 6. Voir les ressources
argocd app resources demo

# 7. Supprimer
argocd app delete demo

Exercice 2 : Explorer l'UI

  1. Ouvrir l'UI et créer une application via le formulaire
  2. Observer le Resource Tree
  3. Cliquer sur un pod et voir les logs
  4. Faire un Diff pour voir les différences
  5. Faire un Rollback à une version précédente

Quiz

Q1. Comment voir les différences entre Git et le cluster ?

Réponse

Via l'UI : Cliquer sur l'application puis sur "DIFF" ou "APP DIFF"

Via le CLI :

argocd app diff my-app

Q2. Comment faire un rollback ?

Réponse
# Voir l'historique
argocd app history my-app

# Rollback à la révision 3
argocd app rollback my-app 3

Ou via l'UI : History → sélectionner une version → Rollback

🔝 Retour à la table des matières


Points clés à retenir

  • UI : Visualisation, monitoring, actions rapides
  • CLI : Automation, scripts, CI/CD
  • Commandes clés : app create, app sync, app get
  • Notifications : Slack, Teams, email
  • L'UI affiche le Resource Tree pour visualiser les dépendances

← Chapitre précédent | Chapitre suivant : ApplicationSets →