first commit

This commit is contained in:
sttlab
2026-07-22 14:41:10 +00:00
commit e1577fe061
35 changed files with 1847 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: postgres
+16
View File
@@ -0,0 +1,16 @@
# Copy to secret.yaml, fill in a real password, and apply with:
# kubectl apply -f secret.yaml
# Never commit the filled-in secret.yaml to git.
#
# This is the Postgres superuser used to provision one database per
# application (see create-db-*-job.yaml). Applications connect with these
# same credentials against their own database (no per-app roles for now).
apiVersion: v1
kind: Secret
metadata:
name: postgres-admin
namespace: postgres
type: Opaque
stringData:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: changeme
+15
View File
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: postgres
namespace: postgres
labels:
app.kubernetes.io/name: postgres
spec:
clusterIP: None
selector:
app.kubernetes.io/name: postgres
ports:
- name: postgres
port: 5432
targetPort: 5432
+61
View File
@@ -0,0 +1,61 @@
# Shared PostgreSQL instance, reusable across applications (miniflux, n8n, ...).
# Each application gets its own database (see create-db-*-job.yaml), all
# reachable through the "postgres" Service below.
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: postgres
namespace: postgres
labels:
app.kubernetes.io/name: postgres
spec:
serviceName: postgres
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: postgres
template:
metadata:
labels:
app.kubernetes.io/name: postgres
spec:
containers:
- name: postgres
image: postgres:18-alpine
ports:
- name: postgres
containerPort: 5432
envFrom:
- secretRef:
name: postgres-admin
env:
- name: PGDATA
value: /var/lib/postgresql/data/pgdata
volumeMounts:
- name: data
mountPath: /var/lib/postgresql/data
resources:
requests:
cpu: 100m
memory: 256Mi
limits:
cpu: 500m
memory: 512Mi
readinessProbe:
exec:
command: ["pg_isready", "-U", "$(POSTGRES_USER)"]
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
exec:
command: ["pg_isready", "-U", "$(POSTGRES_USER)"]
initialDelaySeconds: 15
periodSeconds: 20
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 5Gi