Installation et Configuration
Table des matières
- Prérequis
- Installation standard
- Installation HA
- Accès à l'interface
- Configuration initiale
- Exercices pratiques
1 - Prérequis
Cluster Kubernetes
# Vérifier kubectl
kubectl version --client
# Vérifier l'accès au cluster
kubectl cluster-info
# Version minimum : Kubernetes 1.22+
Options de cluster local
| Option | Commande |
|---|---|
| minikube | minikube start --memory=4096 |
| kind | kind create cluster |
| k3s | `curl -sfL https://get.k3s.io |
| Docker Desktop | Activer Kubernetes dans les settings |
Ressources recommandées
| Composant | CPU | Mémoire |
|---|---|---|
| API Server | 100m | 128Mi |
| Repo Server | 100m | 256Mi |
| Controller | 100m | 256Mi |
| Redis | 50m | 64Mi |
| Total | 350m | 704Mi |
🔝 Retour à la table des matières
2 - Installation standard
Méthode 1 : kubectl apply
# Créer le namespace
kubectl create namespace argocd
# Installer Argo CD
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
# Vérifier l'installation
kubectl get pods -n argocd
Méthode 2 : Helm
# Ajouter le repo Helm
helm repo add argo https://argoproj.github.io/argo-helm
helm repo update
# Installer
helm install argocd argo/argo-cd \
--namespace argocd \
--create-namespace
# Avec valeurs personnalisées
helm install argocd argo/argo-cd \
--namespace argocd \
--create-namespace \
-f values.yaml
Vérification
# Attendre que tous les pods soient prêts
kubectl wait --for=condition=Ready pods --all -n argocd --timeout=300s
# Lister les pods
kubectl get pods -n argocd
# Résultat attendu
NAME READY STATUS RESTARTS
argocd-application-controller-0 1/1 Running 0
argocd-dex-server-xxx 1/1 Running 0
argocd-redis-xxx 1/1 Running 0
argocd-repo-server-xxx 1/1 Running 0
argocd-server-xxx 1/1 Running 0
🔝 Retour à la table des matières
3 - Installation HA (Haute Disponibilité)
Quand utiliser HA ?
- Production avec SLA strict
- Plus de 100 applications
- Multi-cluster à grande échelle
Installation HA
# Manifest HA
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/ha/install.yaml
Différences avec l'installation standard
| Composant | Standard | HA |
|---|---|---|
| API Server | 1 replica | 2+ replicas |
| Repo Server | 1 replica | 2+ replicas |
| Controller | 1 replica | 1 (avec sharding) |
| Redis | Standalone | Redis Sentinel |
Configuration Redis HA
# values.yaml pour Helm HA
redis-ha:
enabled: true
haproxy:
enabled: true
🔝 Retour à la table des matières
4 - Accès à l'interface
Méthode 1 : Port-forward (développement)
# Port-forward vers le service
kubectl port-forward svc/argocd-server -n argocd 8080:443
# Accéder à https://localhost:8080
Méthode 2 : LoadBalancer
# Modifier le service
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'
# Récupérer l'IP externe
kubectl get svc argocd-server -n argocd
Méthode 3 : Ingress
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: argocd-server
namespace: argocd
annotations:
nginx.ingress.kubernetes.io/ssl-passthrough: "true"
nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
spec:
ingressClassName: nginx
rules:
- host: argocd.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: argocd-server
port:
number: 443
Récupérer le mot de passe admin
# Le mot de passe initial est stocké dans un secret
kubectl -n argocd get secret argocd-initial-admin-secret \
-o jsonpath="{.data.password}" | base64 -d && echo
# Connexion
# Username: admin
# Password: (la valeur ci-dessus)
Changer le mot de passe
# Via CLI
argocd account update-password
# Ou supprimer le secret initial après changement
kubectl -n argocd delete secret argocd-initial-admin-secret
🔝 Retour à la table des matières
5 - Configuration initiale
Installer le CLI
# macOS
brew install argocd
# Linux
curl -sSL -o argocd-linux-amd64 https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64
sudo install -m 555 argocd-linux-amd64 /usr/local/bin/argocd
rm argocd-linux-amd64
# Windows (avec chocolatey)
choco install argocd-cli
Se connecter au serveur
# Login
argocd login localhost:8080
# Avec port-forward en arrière-plan
kubectl port-forward svc/argocd-server -n argocd 8080:443 &
argocd login localhost:8080 --username admin --password <password>
# Vérifier la connexion
argocd version
Ajouter un repository Git
# Repository public
argocd repo add https://github.com/org/gitops-repo.git
# Repository privé (HTTPS)
argocd repo add https://github.com/org/private-repo.git \
--username git \
--password <token>
# Repository privé (SSH)
argocd repo add [email protected]:org/private-repo.git \
--ssh-private-key-path ~/.ssh/id_rsa
Configurer via ConfigMap
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-cm
namespace: argocd
data:
# URL du serveur
url: https://argocd.example.com
# Timeout pour les opérations
timeout.reconciliation: 180s
# Activer les status badges
statusbadge.enabled: "true"