ArgoCD & GitOps
ArgoCD synchronise les manifests Kubernetes stockés dans GitLab avec le cluster k3s.
Architecture
GitLab.com (homelab-proxmox/manifests/)
│ push manifest (Deployment, Service, Ingress)
│
▼
ArgoCD (argocd.mounik.ovh)
│ sync automatique (poll 3min + webhook)
│
▼
k3s cluster (applications déployées)
Installation
Déployé via le rôle Ansible argocd dans le namespace argocd :
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
Service exposé en NodePort (30080) → Traefik (VM 101) route argocd.mounik.ovh.
OIDC Keycloak
Configuration dans argocd-cm ConfigMap :
data:
url: https://argocd.mounik.ovh
oidc.config: |
name: Keycloak
issuer: https://keycloak.mounik.ovh/realms/homelab
clientID: argocd
clientSecret: $argocd-oidc-secret
requestedScopes: ['openid', 'profile', 'email']
Mot de passe admin initial :
kubectl -n argocd get secret argocd-initial-admin-secret \
-o jsonpath="{.data.password}" | base64 -d
Dépôt Git connecté
ArgoCD est connecté au dépôt GitLab homelab-proxmox :
- Branche : main
- Chemin : manifests/
- Méthode : clé SSH ou token HTTPS
Application type (exemple FastAPI)
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: fastapi
namespace: argocd
spec:
project: default
source:
repoURL: https://gitlab.com/Mounicou/homelab-proxmox
targetRevision: HEAD
path: manifests/apps/fastapi
destination:
server: https://kubernetes.default.svc
namespace: fastapi
syncPolicy:
automated:
prune: true
selfHeal: true
Déploiement GitOps
- Le pipeline CI/CD build et push l'image sur Harbor
- Le pipeline met à jour le tag image dans
manifests/apps/*/deployment.yaml - Commit et push vers GitLab
- ArgoCD détecte le changement et synchronise le cluster
Pour aller plus loin
- Kubernetes — Vue d'ensemble — cluster k3s
- GitLab Runner — pipelines CI/CD sur k3s
- Phase 5 — Kubernetes — déploiement complet