deployment for athentik
This commit is contained in:
22
apps/authentik-app.yaml
Normal file
22
apps/authentik-app.yaml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: authentik
|
||||||
|
namespace: argocd
|
||||||
|
annotations:
|
||||||
|
argocd.argoproj.io/sync-wave: "2" # Vor Outline (Wave 5) starten
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: https://git.cloud-infra.prod.openmailserver.de/stabify/gitops.git
|
||||||
|
targetRevision: HEAD
|
||||||
|
path: apps/authentik
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: authentik
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
10
apps/authentik/Chart.yaml
Normal file
10
apps/authentik/Chart.yaml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
apiVersion: v2
|
||||||
|
name: authentik-wrapper
|
||||||
|
description: Wrapper chart for Authentik
|
||||||
|
type: application
|
||||||
|
version: 1.0.0
|
||||||
|
appVersion: "1.0.0"
|
||||||
|
dependencies:
|
||||||
|
- name: authentik
|
||||||
|
repository: https://charts.goauthentik.io
|
||||||
|
version: 2024.12.0 # Aktuelle Version prüfen oder latest nehmen
|
||||||
52
apps/authentik/VAULT_SETUP.md
Normal file
52
apps/authentik/VAULT_SETUP.md
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
# Vault Secrets für Authentik anlegen
|
||||||
|
|
||||||
|
Authentik benötigt Secrets für die Datenbank, Redis und seinen eigenen Encryption Key.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Umgebungsvariablen für Vault
|
||||||
|
export VAULT_ADDR='https://10.100.30.11:8200'
|
||||||
|
export VAULT_TOKEN='DeinRootToken' # Ersetzen!
|
||||||
|
export VAULT_CACERT='./vault-ca.crt'
|
||||||
|
|
||||||
|
# 1. Passwörter generieren
|
||||||
|
PG_PASS=$(openssl rand -hex 16)
|
||||||
|
REDIS_PASS=$(openssl rand -hex 16)
|
||||||
|
SECRET_KEY=$(openssl rand -hex 32)
|
||||||
|
BOOTSTRAP_TOKEN=$(openssl rand -hex 16) # Token für ersten Admin-Login (ak-admin)
|
||||||
|
|
||||||
|
# 2. Email Passwort (Optional, sonst leer lassen)
|
||||||
|
EMAIL_PASS="supersecret"
|
||||||
|
|
||||||
|
# 3. In Vault schreiben
|
||||||
|
vault kv put secret/apps/authentik \
|
||||||
|
postgres_password="$PG_PASS" \
|
||||||
|
redis_password="$REDIS_PASS" \
|
||||||
|
secret_key="$SECRET_KEY" \
|
||||||
|
bootstrap_token="$BOOTSTRAP_TOKEN" \
|
||||||
|
email_password="$EMAIL_PASS"
|
||||||
|
|
||||||
|
echo "Dein Bootstrap Token für den ersten Login: $BOOTSTRAP_TOKEN"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Erster Login
|
||||||
|
|
||||||
|
1. Öffne `https://auth.apps.k3s.stabify.de/if/flow/initial-setup/`
|
||||||
|
2. Logge dich mit User `ak-admin` und dem `BOOTSTRAP_TOKEN` ein (oder setze dort das Passwort).
|
||||||
|
|
||||||
|
### Outline Integration
|
||||||
|
|
||||||
|
Nachdem Authentik läuft:
|
||||||
|
1. Erstelle im Authentik Admin Interface einen **Provider** (OAuth2/OpenID) für Outline.
|
||||||
|
* Redirect URI: `https://kb.apps.k3s.stabify.de/auth/oidc.callback`
|
||||||
|
2. Erstelle eine **Application** "Outline" und verknüpfe den Provider.
|
||||||
|
3. Kopiere **Client ID** und **Client Secret** aus Authentik.
|
||||||
|
4. Update die Outline Secrets in Vault:
|
||||||
|
```bash
|
||||||
|
vault kv patch secret/apps/outline \
|
||||||
|
oidc_client_id="<Client-ID-aus-Authentik>" \
|
||||||
|
oidc_client_secret="<Client-Secret-aus-Authentik>" \
|
||||||
|
oidc_auth_uri="https://auth.apps.k3s.stabify.de/application/o/authorize/" \
|
||||||
|
oidc_token_uri="https://auth.apps.k3s.stabify.de/application/o/token/" \
|
||||||
|
oidc_userinfo_uri="https://auth.apps.k3s.stabify.de/application/o/userinfo/"
|
||||||
|
```
|
||||||
|
5. Restart Outline Pods.
|
||||||
52
apps/authentik/external-secret.yaml
Normal file
52
apps/authentik/external-secret.yaml
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
apiVersion: external-secrets.io/v1beta1
|
||||||
|
kind: ExternalSecret
|
||||||
|
metadata:
|
||||||
|
name: authentik-secrets
|
||||||
|
namespace: authentik
|
||||||
|
spec:
|
||||||
|
refreshInterval: 1m
|
||||||
|
secretStoreRef:
|
||||||
|
name: vault-backend
|
||||||
|
kind: ClusterSecretStore
|
||||||
|
target:
|
||||||
|
name: authentik-secrets
|
||||||
|
creationPolicy: Owner
|
||||||
|
data:
|
||||||
|
# Genereller Secret Key für Authentik
|
||||||
|
- secretKey: AUTHENTIK_SECRET_KEY
|
||||||
|
remoteRef:
|
||||||
|
key: secret/apps/authentik
|
||||||
|
property: secret_key
|
||||||
|
|
||||||
|
# Email Passwort (Optional)
|
||||||
|
- secretKey: AUTHENTIK_EMAIL__PASSWORD
|
||||||
|
remoteRef:
|
||||||
|
key: secret/apps/authentik
|
||||||
|
property: email_password
|
||||||
|
|
||||||
|
# DB & Redis Passwörter für Authentik Config (Env Vars)
|
||||||
|
- secretKey: AUTHENTIK_POSTGRESQL__PASSWORD
|
||||||
|
remoteRef:
|
||||||
|
key: secret/apps/authentik
|
||||||
|
property: postgres_password
|
||||||
|
- secretKey: AUTHENTIK_REDIS__PASSWORD
|
||||||
|
remoteRef:
|
||||||
|
key: secret/apps/authentik
|
||||||
|
property: redis_password
|
||||||
|
|
||||||
|
# Passwörter für die Infrastruktur-Container (Postgres/Redis Pods selbst)
|
||||||
|
# Diese Keys werden in values.yaml referenziert
|
||||||
|
- secretKey: postgres-password
|
||||||
|
remoteRef:
|
||||||
|
key: secret/apps/authentik
|
||||||
|
property: postgres_password
|
||||||
|
- secretKey: redis-password
|
||||||
|
remoteRef:
|
||||||
|
key: secret/apps/authentik
|
||||||
|
property: redis_password
|
||||||
|
|
||||||
|
# Initial Admin Token (optional, zum Bootstrappen)
|
||||||
|
- secretKey: AUTHENTIK_BOOTSTRAP_TOKEN
|
||||||
|
remoteRef:
|
||||||
|
key: secret/apps/authentik
|
||||||
|
property: bootstrap_token
|
||||||
79
apps/authentik/values.yaml
Normal file
79
apps/authentik/values.yaml
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
authentik:
|
||||||
|
# WICHTIG: Authentik braucht Secrets. Wir injizieren sie via EnvVars aus dem ExternalSecret
|
||||||
|
# Das Chart erlaubt "envValueFrom" oder Referenzen.
|
||||||
|
|
||||||
|
error_reporting:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
# Wir nutzen einen externen Secret-Namen, den das ExternalSecret erzeugt
|
||||||
|
# Das Chart kann Secrets mappen, oder wir setzen Env Vars manuell in "extraEnv".
|
||||||
|
|
||||||
|
# Authentik Config
|
||||||
|
email:
|
||||||
|
host: "smtp.example.com" # Dummy, später via Vault
|
||||||
|
port: 587
|
||||||
|
username: "user"
|
||||||
|
use_tls: true
|
||||||
|
from: "authentik@stabify.de"
|
||||||
|
|
||||||
|
postgresql:
|
||||||
|
enabled: true
|
||||||
|
auth:
|
||||||
|
existingSecret: "authentik-secrets"
|
||||||
|
secretKeys:
|
||||||
|
adminPasswordKey: "postgres-password"
|
||||||
|
userPasswordKey: "postgres-password" # Authentik nutzt User PW
|
||||||
|
primary:
|
||||||
|
persistence:
|
||||||
|
enabled: true
|
||||||
|
size: 8Gi
|
||||||
|
|
||||||
|
redis:
|
||||||
|
enabled: true
|
||||||
|
auth:
|
||||||
|
existingSecret: "authentik-secrets"
|
||||||
|
existingSecretPasswordKey: "redis-password"
|
||||||
|
architecture: standalone
|
||||||
|
|
||||||
|
ingress:
|
||||||
|
enabled: true
|
||||||
|
ingressClassName: traefik
|
||||||
|
annotations:
|
||||||
|
cert-manager.io/cluster-issuer: letsencrypt-prod
|
||||||
|
traefik.ingress.kubernetes.io/router.entrypoints: websecure
|
||||||
|
traefik.ingress.kubernetes.io/router.tls: "true"
|
||||||
|
hosts:
|
||||||
|
- host: auth.apps.k3s.stabify.de
|
||||||
|
paths:
|
||||||
|
- path: "/"
|
||||||
|
pathType: Prefix
|
||||||
|
tls:
|
||||||
|
- secretName: authentik-tls
|
||||||
|
hosts:
|
||||||
|
- auth.apps.k3s.stabify.de
|
||||||
|
|
||||||
|
# Worker Configuration (muss auch Secrets kennen)
|
||||||
|
# Das Chart zieht sich "authentik-secrets" nicht automatisch für alles.
|
||||||
|
# Wir müssen "authentik_secret_key" setzen.
|
||||||
|
|
||||||
|
# Wir nutzen "envFrom" um alle Secrets aus "authentik-secrets" zu laden
|
||||||
|
# Leider unterstützt das Chart "envFrom" nicht direkt auf Top-Level für alle Komponenten?
|
||||||
|
# Doch, meistens. Ich prüfe die Chart-Values Struktur...
|
||||||
|
# Wir setzen es explizit.
|
||||||
|
|
||||||
|
authentik:
|
||||||
|
secret_key: "" # Wird überschrieben durch Env Var AUTHENTIK_SECRET_KEY aus Secret
|
||||||
|
# bootstrap_token: "" # Initial Admin Token (optional)
|
||||||
|
|
||||||
|
# Server deployment env
|
||||||
|
server:
|
||||||
|
envFrom:
|
||||||
|
- secretRef:
|
||||||
|
name: authentik-secrets
|
||||||
|
|
||||||
|
# Worker deployment env
|
||||||
|
worker:
|
||||||
|
envFrom:
|
||||||
|
- secretRef:
|
||||||
|
name: authentik-secrets
|
||||||
|
|
||||||
Reference in New Issue
Block a user