Aller au contenu principal

Installation et Configuration


Table des matières

  1. Prérequis
  2. Installation standard
  3. Installation HA
  4. Accès à l'interface
  5. Configuration initiale
  6. 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

OptionCommande
minikubeminikube start --memory=4096
kindkind create cluster
k3s`curl -sfL https://get.k3s.io
Docker DesktopActiver Kubernetes dans les settings

Ressources recommandées

ComposantCPUMémoire
API Server100m128Mi
Repo Server100m256Mi
Controller100m256Mi
Redis50m64Mi
Total350m704Mi

🔝 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

ComposantStandardHA
API Server1 replica2+ replicas
Repo Server1 replica2+ replicas
Controller1 replica1 (avec sharding)
RedisStandaloneRedis 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"

🔝 Retour à la table des matières


6 - Exercices pratiques

Exercice 1 : Installation locale

# 1. Créer un cluster local
minikube start --memory=4096

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

# 3. Attendre les pods
kubectl wait --for=condition=Ready pods --all -n argocd --timeout=300s

# 4. Récupérer le mot de passe
kubectl -n argocd get secret argocd-initial-admin-secret \
-o jsonpath="{.data.password}" | base64 -d && echo

# 5. Port-forward et accéder
kubectl port-forward svc/argocd-server -n argocd 8080:443

Quiz

Q1. Quel namespace est créé par défaut pour Argo CD ?

Réponse

Le namespace argocd. C'est le namespace standard utilisé dans les manifests officiels.

Q2. Comment récupérer le mot de passe admin initial ?

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

🔝 Retour à la table des matières


Points clés à retenir

  • Installation simple via kubectl apply ou Helm
  • HA pour la production à grande échelle
  • Accès via port-forward, LoadBalancer ou Ingress
  • Le mot de passe initial est dans un Secret
  • CLI argocd pour l'administration

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