# One-off Job to create the "n8n" database on the shared Postgres instance. # Mirrors k8s/miniflux/create-db-job.yaml. apiVersion: batch/v1 kind: Job metadata: name: create-db-n8n namespace: postgres spec: backoffLimit: 3 template: spec: restartPolicy: Never containers: - name: create-db image: postgres:18-alpine envFrom: - secretRef: name: postgres-admin command: - sh - -c - | set -e psql "postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres-postgresql:5432/postgres" \ -tc "SELECT 1 FROM pg_database WHERE datname = 'n8n'" | grep -q 1 \ || psql "postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres-postgresql:5432/postgres" \ -c "CREATE DATABASE n8n"