Files
Artista-Filmcamp/k8s/README.md
T
Nick SzaunigandClaude Opus 5.5 9c7d2d02a2
Docker-Images bauen und veroeffentlichen / build-and-push (push) Successful in 1m53s
docs(k8s): Deployment Schritt fuer Schritt wie bei Wabenhain
Voraussetzungen pruefen (Traefik, cert-manager, csi-driver-smb),
Einzel-Applies in Reihenfolge mit kubectl wait auf Postgres,
Fehlersuche fuer Migration, App und Zertifikat.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 06:33:47 +02:00

68 lines
3.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ARTISTA Modelcamp in Kubernetes (RKE2)
Rohe Manifeste wie bei Wabenhain, Nummerierung = Reihenfolge. Voraussetzungen im Cluster (wie bei Wabenhain):
- **Traefik** als Ingress-Controller (IngressClass `traefik`)
- **cert-manager** mit dem ClusterIssuer `letsencrypt-prod`
- **csi-driver-smb** für die SMB-Volumes
Prüfen:
```bash
kubectl get ingressclass
kubectl get clusterissuer letsencrypt-prod
kubectl get pods -A -l 'app.kubernetes.io/name in (traefik,rke2-traefik)'
```
## Einmalige Vorbereitung
1. **Images:** `.gitea/workflows/docker-build.yml` baut bei jedem Push auf `main` die Images `git.encry.de/nick.rosenloecher/artista-modelcamp:latest` und `…-tools:latest`. Voraussetzung ist das Repo-Secret `REGISTRY_TOKEN` (Personal Access Token mit `package`-Scope), wie bei Wabenhain.
2. **csi-driver-smb** (falls noch nicht vorhanden):
```bash
helm repo add csi-driver-smb https://raw.githubusercontent.com/kubernetes-csi/csi-driver-smb/master/charts
helm install csi-driver-smb csi-driver-smb/csi-driver-smb -n kube-system
```
3. **NAS:** Die Ordner `artista/modelcamp-postgres` (leer) und `artista/modelcamp-media` anlegen und SMB-Verschlüsselung erlauben. `nas.example.lan` in `02-storage.yaml` anpassen.
4. **Domain:** `modelcamp.example.org` in `01-config.yaml` (APP_URL) und `05-ingress.yaml` (2×) ersetzen. Der DNS-Eintrag muss auf den Cluster zeigen, sonst stellt cert-manager kein Zertifikat aus.
5. **Secrets:** `cp k8s/secrets.yaml.example k8s/secrets.yaml` und ausfüllen. Die Datei steht in `.gitignore`, bitte **nie** mit echten Werten committen.
## Deployment
```bash
kubectl apply -f k8s/00-namespace.yaml
kubectl apply -f k8s/secrets.yaml
kubectl apply -f k8s/01-config.yaml
kubectl apply -f k8s/02-storage.yaml
kubectl apply -f k8s/03-postgres.yaml
kubectl wait --for=condition=ready pod -l app=artista-modelcamp-postgres -n artista --timeout=180s
kubectl apply -f k8s/04-app.yaml
kubectl apply -f k8s/05-ingress.yaml
kubectl apply -f k8s/06-worker.yaml
kubectl apply -f k8s/07-networkpolicy.yaml
```
Die Migration läuft automatisch als initContainer vor dem App-Start. Den Fortschritt zeigt `kubectl rollout status deployment/artista-modelcamp-app -n artista`, das Zertifikat `kubectl get certificate -n artista`.
## Erstes Admin-Konto
E-Mail und Name ersetzen. Das einmalige Passwort wird ausgegeben, die 2FA richtest du bei der ersten Anmeldung unter `/admin` ein.
```bash
kubectl -n artista run admin-create --rm -i --restart=Never \
--image=git.encry.de/nick.rosenloecher/artista-modelcamp-tools:latest --labels=db-client=true \
--overrides='{"spec":{"securityContext":{"runAsNonRoot":true,"runAsUser":1001,"seccompProfile":{"type":"RuntimeDefault"}},"containers":[{"name":"admin-create","image":"git.encry.de/nick.rosenloecher/artista-modelcamp-tools:latest","command":["tsx","scripts/create-admin.ts","--email","[email protected]","--name","Dein Name"],"envFrom":[{"configMapRef":{"name":"artista-modelcamp-config"}},{"secretRef":{"name":"artista-modelcamp-secrets"}}],"securityContext":{"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]}}}]}}'
```
## Bei einem neuen Image (Redeploy)
```bash
kubectl rollout restart deployment/artista-modelcamp-app -n artista
```
## Fehlersuche
```bash
kubectl -n artista logs deploy/artista-modelcamp-app -c migrate # Migration
kubectl -n artista logs deploy/artista-modelcamp-app -c app # App
kubectl -n artista describe certificate artista-modelcamp-tls # Zertifikat
```