Agent skill · software engineering · aiskillstore
deploying-postgres-k8s
Deploys PostgreSQL on Kubernetes using the CloudNativePG operator with automated failover. Use when setting up PostgreSQL for production workloads, high availability, or local K8s development. Covers operator installation, cluster creation, connection secrets, and backup configuration. NOT when using managed Postgres (Neon, RDS, Cloud SQL) or simple Docker containers.
Why this skill is useful
Adds specific Kubernetes commands and configurations for deploying PostgreSQL clusters that the AI wouldn't reliably generate on its own.
What it needs
Requires helm, kubectl installed locally. About 3k tokens when loaded. Last updated 2026-08-07. 405 stars on the source repository.
What this skill does
Deploying PostgreSQL on Kubernetes Deploy production-ready PostgreSQL clusters using CloudNativePG operator (v1.28+) with automated failover. Quick Start Operator Installation Direct Manifest (Recommended) Helm Installation Namespace-Scoped (Enhanced Security) Cluster Configurations Development (Single Instance) Production (HA with 3 Replicas) With Bootstrap Database Create the secret first: Connection Secrets CloudNativePG automatically creates connection secrets: Secret Contents -------- ---------- pg-cluster-app App credentials (recommended) pg-cluster-superuser Superuser credentials Get Connection String Use in Deployment Service Endpoints Service Port Use --------- ------ ----- pg-cluster-rw 5432 Read-Write (primary) pg-cluster-ro 5432 Read-Only (replicas) pg-cluster-r 5432 Any instance Connect from Another Namespace Database Operations Connect with psql Create Database and User Run Migrations Backup Configuration Backup to S3 Schedule Backups Monitoring Check Cluster Status View Logs Prometheus Metrics With enablePodMonitor: true, metrics available at: cnpgbackendstotal - Active connections cnpgpgreplicationlagseconds - Replica lag cnpgpgdatabasesizebytes - Database size Troubleshooting Cluster Not Ready Connection Issues Common Issues Error Cause Fix ------- ------- ----- PVC pending No storage class Add storageClass to spec Connection refused Wrong service name Use cluster-rw for writes Auth failed Wrong credentials Check secret cluster-app Replica lag high Heavy writes Scale up, increase resources Cleanup Verification Run: python scripts/verify.py Related Skills operating-k8s-local - Local Minikube cluster setup scaffolding-fastapi-dapr - FastAPI services with SQLModel deploying-kafka-k8s - Kafka for event-driven architecture
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills aiskillstore/deploying-postgres-k8s