PostgreSQL Kubernetes Setup
This skill deploys PostgreSQL on Kubernetes using the Bitnami Helm chart, executes initial schema migrations, and verifies the database schema. It handles the full database bootstrap sequence — cluster deploy, migration run, schema check — and returns a compact pass/fail status to keep context usage low.
Use this skill at infrastructure setup time, or after a schema change that requires migration execution against a Kubernetes-hosted Postgres instance.
Quick Start
# Deploy Postgres and run migrations from migrations/ directory
/postgres-k8s-setup namespace=app-db migrations_dir=./migrations
# Expected output:
# PostgreSQL deployed in namespace app-db
# Migrations: 3 applied successfully
# Schema verified: Done
Key Features
- Deploys PostgreSQL via the Bitnami Helm chart in a dedicated namespace
- Executes SQL migration files in order from a specified directory
- Verifies the resulting schema matches expected tables/columns
- Returns only success/failure status — no verbose query output — to minimize context window usage
- Supports custom
values.yamloverrides for storage class, resource limits, and credentials
Process
- Deploy PostgreSQL using Helm in a dedicated namespace
- Execute initial schema migrations via
kubectl execor a migration job - Verify the database schema
- Return only success/failure status
When NOT to Use This Skill
- Managed Postgres (AWS RDS, Cloud SQL, Supabase) — use their native provisioning tools; this skill targets self-hosted Kubernetes only
- Schema migrations in production without review — always review migration files before running this skill against a production database
- Large datasets or complex migrations — for multi-hour migrations, use a dedicated migration tool (Flyway, Alembic) with rollback support rather than this skill
Common Mistakes
- Not setting
persistence.enabled=truein Helm values — default ephemeral storage causes complete data loss when the pod restarts - Running migrations without a backup — always snapshot the PVC or use
pg_dumpbefore applying schema changes - Using the default Bitnami credentials (
postgres/postgres) in production — always overrideauth.passwordandauth.postgresPasswordvia a Kubernetes secret