136 lines
3.7 KiB
YAML
136 lines
3.7 KiB
YAML
---
|
|
# REDIS
|
|
# HINWEIS:
|
|
# - Redis wird hier auf einem PersistentVolume (Longhorn) betrieben.
|
|
# - Repliken = 1 bedeutet: Kein echtes Redis-HA, aber Daten überleben Node-/Pod-Neustarts.
|
|
# - Für echtes Redis-HA (Multi-Node-Failover) brauchst du später Redis Sentinel / Redis Operator
|
|
# oder ein extern verwaltetes Redis (Managed DB).
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: outline-redis
|
|
namespace: outline
|
|
spec:
|
|
serviceName: outline-redis
|
|
replicas: 1 # Für echtes HA später Redis Sentinel/Cluster einsetzen
|
|
selector:
|
|
matchLabels:
|
|
app: outline-redis
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: outline-redis
|
|
spec:
|
|
containers:
|
|
- name: redis
|
|
image: redis:alpine
|
|
command: ["redis-server", "--requirepass", "$(REDIS_PASSWORD)"]
|
|
ports:
|
|
- containerPort: 6379
|
|
env:
|
|
- name: REDIS_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: outline-secrets
|
|
key: redis-password
|
|
volumeMounts:
|
|
- name: redis-data
|
|
mountPath: /data
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: redis-data
|
|
spec:
|
|
accessModes: ["ReadWriteOnce"]
|
|
storageClassName: longhorn
|
|
resources:
|
|
requests:
|
|
storage: 2Gi
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: outline-redis
|
|
namespace: outline
|
|
spec:
|
|
ports:
|
|
- port: 6379
|
|
targetPort: 6379
|
|
selector:
|
|
app: outline-redis
|
|
---
|
|
# POSTGRES
|
|
# HINWEIS: PostgreSQL HA benötigt Replication (Primary/Standby), nicht einfach mehr Replicas!
|
|
# ReadWriteOnce PVC kann nur auf einem Pod gemountet werden
|
|
# Für HA: Patroni + etcd oder Managed PostgreSQL verwenden
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: outline-postgres
|
|
namespace: outline
|
|
spec:
|
|
serviceName: outline-postgres
|
|
replicas: 1 # HA: PostgreSQL Replication erforderlich (Patroni + etcd)
|
|
selector:
|
|
matchLabels:
|
|
app: outline-postgres
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: outline-postgres
|
|
spec:
|
|
# InitContainer: Bereinige lost+found Verzeichnis von Longhorn
|
|
initContainers:
|
|
- name: init-postgres-data
|
|
image: busybox:latest
|
|
command: ["sh", "-c"]
|
|
args:
|
|
- |
|
|
# Entferne lost+found Verzeichnis (wird von Longhorn/ext4 erstellt)
|
|
rm -rf /var/lib/postgresql/data/lost+found
|
|
# Stelle sicher, dass das Verzeichnis leer ist
|
|
find /var/lib/postgresql/data -mindepth 1 -maxdepth 1 ! -name "lost+found" -exec rm -rf {} + || true
|
|
securityContext:
|
|
runAsUser: 0
|
|
volumeMounts:
|
|
- name: postgres-data
|
|
mountPath: /var/lib/postgresql/data
|
|
containers:
|
|
- name: postgres
|
|
image: postgres:15-alpine
|
|
ports:
|
|
- containerPort: 5432
|
|
env:
|
|
- name: POSTGRES_DB
|
|
value: outline
|
|
- name: POSTGRES_USER
|
|
value: outline
|
|
- name: POSTGRES_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: outline-secrets
|
|
key: postgres-password
|
|
volumeMounts:
|
|
- name: postgres-data
|
|
mountPath: /var/lib/postgresql/data
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: postgres-data
|
|
spec:
|
|
accessModes: [ "ReadWriteOnce" ]
|
|
storageClassName: longhorn
|
|
resources:
|
|
requests:
|
|
storage: 5Gi
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: outline-postgres
|
|
namespace: outline
|
|
spec:
|
|
ports:
|
|
- port: 5432
|
|
targetPort: 5432
|
|
selector:
|
|
app: outline-postgres
|