feat(k8s): Add Keycloak 26.6.0 with PostgreSQL 16 and classic-models realm CaC

This commit is contained in:
Stéphane Tailland
2026-08-23 07:40:40 +02:00
parent 31e6b1d6d7
commit 6d3431c2d5
14 changed files with 384 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
# Infra Keycloak (Kubernetes / CaC)
Déploiement de **Keycloak 26.6.0** et **PostgreSQL 16** en Configuration-as-Code (CaC) sous Kubernetes dans le namespace `keycloak`.
## Structure du Répertoire
```text
k8s/
├── kustomization.yaml # Manifeste Kustomize principal
├── namespace.yaml # Namespace keycloak
├── secret.yaml # Secrets (Admin, DB, OIDC secrets)
├── secret.example.yaml # Gabarit des secrets
├── postgresql/
│ ├── pvc.yaml # Stockage persistant PostgreSQL (2Gi)
│ ├── statefulset.yaml # Base de données PostgreSQL 16
│ └── service.yaml # Service PostgreSQL (port 5432)
├── keycloak/
│ ├── configmap-realm.yaml # Realm classic-models (Configuration-as-Code)
│ ├── deployment.yaml # Déploiement Keycloak 26.6.0 (--import-realm)
│ └── service.yaml # Service Keycloak (ports 8080, 9000)
└── ingress/
├── tls.yaml # Secret TLS wildcard (*.sttlab.local)
└── ingress.yaml # Ingress NGINX (keycloak.sttlab.local)
```
## Fonctionnalités Clés
- **Version Keycloak** : `quay.io/keycloak/keycloak:26.6.0` (Runtime Quarkus).
- **Import Automatique du Realm (CaC)** : Le realm `classic-models` est chargé au démarrage via l'option `--import-realm` depuis le `ConfigMap` monté dans `/opt/keycloak/data/import/`.
- **Token Exchange RFC 8693** : Activé via `KC_FEATURES: "token-exchange,admin-fine-grained-authz"`.
- **Clients Configurés** :
- `librechat` : Client OIDC pour le login et le flux OAuth MCP.
- `mcp-catalog` : Audience du serveur MCP.
- `kong-token-exchange-broker` : Échangeur de jetons RFC 8693 de Kong Gateway.
- `catalog-api` & `classic-models-api` : Audiences des services backend.
- **Utilisateurs & Rôles** :
- `admin-user` (`admin`)
- `pm-user` (`product_manager`)
- `ro-user` (`read_only`)
- `customer-user` (`customer`)
- `support-user` (`support`)
## Déploiement
```bash
kubectl apply -k k8s/
```