← ClaudeAtlas

deploying-postgres-k8slisted

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.
aiskillstore/marketplace · ★ 329 · DevOps & Infrastructure · score 79
Install: claude install-skill aiskillstore/marketplace
# Deploying PostgreSQL on Kubernetes Deploy production-ready PostgreSQL clusters using CloudNativePG operator (v1.28+) with automated failover. ## Quick Start ```bash # 1. Install CloudNativePG operator kubectl apply --server-side -f \ https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-1.28/releases/cnpg-1.28.0.yaml # 2. Wait for operator kubectl rollout status deployment -n cnpg-system cnpg-controller-manager # 3. Deploy PostgreSQL cluster kubectl apply -f - <<EOF apiVersion: postgresql.cnpg.io/v1 kind: Cluster metadata: name: pg-cluster spec: instances: 3 storage: size: 10Gi EOF # 4. Wait for cluster kubectl wait cluster/pg-cluster --for=condition=Ready --timeout=300s ``` ## Operator Installation ### Direct Manifest (Recommended) ```bash kubectl apply --server-side -f \ https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-1.28/releases/cnpg-1.28.0.yaml # Verify kubectl rollout status deployment -n cnpg-system cnpg-controller-manager kubectl get pods -n cnpg-system ``` ### Helm Installation ```bash helm repo add cnpg https://cloudnative-pg.github.io/charts helm repo update helm upgrade --install cnpg \ --namespace cnpg-system \ --create-namespace \ cnpg/cloudnative-pg ``` ### Namespace-Scoped (Enhanced Security) ```bash helm upgrade --install cnpg \ --namespace cnpg-system \ --create-namespace \ --set config.clusterWide=false \ cnpg