PostgreSQL
PostgreSQL
Shared PostgreSQL 16 instance used by other homelab services (Media Indexer, Postgres MCP, and connections registered in pgAdmin). Runs in the default namespace of the k3s cluster.
Deployment
| Item | Value |
|---|---|
| Image | postgres:16 |
| Namespace | default |
| Replicas | 1 (Recreate strategy) |
| Service | LoadBalancer, port 5432 (MetalLB-assigned external IP 192.168.1.33) |
| Storage | postgres-data PVC, 5Gi, longhorn storage class, mounted at /var/lib/postgresql/data |
| Data directory | PGDATA=/var/lib/postgresql/data/pgdata (subdirectory of the PVC mount, avoiding issues with lost+found in the volume root) |
| Credentials | POSTGRES_USER / POSTGRES_PASSWORD / POSTGRES_DB loaded in full via envFrom.secretRef from the postgres-secret Secret |
| Auto-reload | reloader.stakater.com/auto: "true" |
Storage
Uses the longhorn storage class rather than local-path: the single replica has no node affinity pinning it to a specific node, so a Longhorn-backed volume (which replicates across nodes and binds Immediate) lets the pod reschedule elsewhere without losing data if its current node goes down.
Access
The LoadBalancer Service exposes Postgres directly on the LAN at 192.168.1.33:5432 — there’s no ingress/TLS layer in front of it, since the Postgres wire protocol isn’t HTTP. Consumers on the cluster (Postgres MCP, Media Indexer) instead reach it via the in-cluster DNS name postgres.default.svc.cluster.local:5432.