← ClaudeAtlas

cnpglisted

Create and operate CloudNativePG (CNPG) Postgres databases on Kubernetes the GitOps/Flux way — on managed cloud (GKE + GCS via Workload Identity) OR self-hosted (K3s/bare-metal + any S3-compatible store via a credentials secret). Covers Cluster + ScheduledBackup manifests, barman WAL archiving, pgvector, PITR, prod→dev clones, and the NetworkPolicies a default-deny cluster needs. Use when provisioning a new app database, cloning prod into dev, enabling pgvector, wiring backups/PITR, writing CNPG NetworkPolicies, or debugging the silent "WAL archiving failed → PVC fills → Postgres CrashLoop → app can't read data" chain on CloudNativePG.
vanducng/skills · ★ 0 · AI & Automation · score 73
Install: claude install-skill vanducng/skills
# cnpg Provision and run CloudNativePG (CNPG) Postgres on Kubernetes as GitOps. Every concrete identifier below is a placeholder — substitute your own: `<project>`, `<gcp-sa>`, `<backups-bucket>`, `<cluster>`, `<ns>`, `<svc>`, `<db>`, `<owner>`, `<env>`, `<s3-endpoint>`, `<objstore-secret>`, `<app-ns>`. **Two platforms, one operator.** The Cluster spec, bootstrap, pgvector, PITR, clone, and most gotchas are identical everywhere. Only **backup auth** and **NetworkPolicy** differ: - **Managed cloud (GKE + GCS):** backup auth = Workload Identity (no keys). Steps below default to this. - **Self-hosted (K3s / bare-metal + S3-compatible store: MinIO, Ceph, R2, B2):** backup auth = an access-key Secret; plus a default-deny cluster needs explicit NetworkPolicies. See **`references/self-hosted-and-networkpolicy.md`** — read it whenever there's no cloud Workload Identity or the cluster enforces default-deny. ## Mental model — two halves that MUST share one string A CNPG database on GKE is two halves that have to agree on exactly one string, `<ns>/<cluster>`: 1. **GitOps half (k8s YAML):** a CNPG `Cluster` whose `serviceAccountTemplate` annotation points the auto-created **pod KSA** at the GCP backup SA. CNPG names that pod KSA after the **cluster** (`<cluster>`) in `<ns>`. Any standalone `ServiceAccount` named `cnpg-backup-sa` you find in a folder is a **decoy/legacy** resource — CNPG does **not** use it for backup auth. 2. **GCP half (Terraform):** an IAM `wo