Interface Web et CLI
Table des matières
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
| Page | Description |
|---|---|
| Applications | Liste de toutes les apps |
| Settings | Configuration, repos, clusters |
| User Info | Profil 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
| Action | Description |
|---|---|
| SYNC | Synchroniser avec Git |
| REFRESH | Recharger depuis Git |
| ROLLBACK | Revenir à une version |
| DELETE | Supprimer 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
| Trigger | Description |
|---|---|
on-deployed | Après sync réussi |
on-health-degraded | Santé dégradée |
on-sync-failed | Échec de sync |
on-sync-running | Sync en cours |
on-sync-status-unknown | Status 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
- Ouvrir l'UI et créer une application via le formulaire
- Observer le Resource Tree
- Cliquer sur un pod et voir les logs
- Faire un Diff pour voir les différences
- 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