Skip to content
Agentmart
Submit a tool

cnpg

Use when working with CloudNativePG (CNPG) for PostgreSQL on Kubernetes — creating or troubleshooting Cluster, Backup, ScheduledBackup, Pooler, or…

Skill by Aidas-dev

IndexedMIT★ 4
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/aidas-dev-cnpg

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Use when working with CloudNativePG (CNPG) for PostgreSQL on Kubernetes — creating or troubleshooting Cluster, Backup, ScheduledBackup, Pooler, or ImageCatalog resources; defining bootstrap, storage, backup, or affinity settings.

Use cases: devops

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/cnpg

What's inside

Skill name
cnpg
Description
Use when working with CloudNativePG (CNPG) for PostgreSQL on Kubernetes — creating or troubleshooting Cluster, Backup, ScheduledBackup, Pooler, or ImageCatalog resources; defining bootstrap, storage, backup, or affinity settings.
License
MIT
Instructions
127 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# CloudNativePG (CNPG)

## Overview

CloudNativePG operator manages HA PostgreSQL clusters on Kubernetes. API: `postgresql.cnpg.io/v1`. Deployed via Helm chart (latest: 0.28.2 \u2192 operator 1.29.1).

## CRD Reference

| CRD | Purpose |
|-----|---------|
| `Cluster` | HA PostgreSQL cluster (core resource) |
| `Backup` | On-demand backup |
| `ScheduledBackup` | Cron-based backup schedule |
| `Pooler` | PgBouncer connection pooler |
| `Database` | Database-level management within cluster |
| `Publication` / `Subscription` | Logical replication |
| `ImageCatalog` / `ClusterImageCatalog` | Extension image management (v1.29+) |
| `FailoverQuorum` | Quorum-based failover settings |

## Cluster Spec (Key Fields)

```yaml
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
spec:
  instances: 1                    # Replicas (1 = standalone primary)
  imageName: ghcr.io/cloudnative-pg/postgresql:18

  storage:
    size: 10Gi
    storageClass: ceph-block      # Omit or null for cluster default
    resizePVC: true               # Allow storage resize via Helm upgrade

  walStorage:                     # Optional \u2014 separate WAL volume
    size: 5Gi
    storageClass: ceph-block

  bootstrap:
    initdb:
      database: app               # Default DB name
      owner: app                  # Default owner user
      postInitSQL:                # Run after init
        - CREATE EXTENSION vector;

  affinity:
    nodeSelector:
      kubernetes.io/hostname: worker-01
    podAntiAffinity:
      type: preferred             # required or preferred
      topologyKey: kubernetes.io/hostname

  postgresql:
    parameters:
      shared_preload_libraries: vector  # Extensions
    pg_hba:                             # Custom pg_hba (v1.29+ use podSelectorRefs)

  primaryUpdateStrategy: unsupervised   # unsupervised (default) or switchover
  primaryUpdateMethod: restart          # restart or switchover

  monitoring:
    enablePodMonitor: true              # Generates Prometheus PodMonitor

  backup:
    volumeSnapshot:
      snapshotClass: csi-ceph-block     # CSI snapshot class
```

## Bootstrap Methods

| Method | Use case |
|--------|----------|
| `initdb` | Fresh cluster from scratch |
| `pg_basebackup` | Clone from existing CNPG cluster |
| `recovery` | PITR from Barman/volumeSnapshot/plugin backup |
| `pg_basebackup` via `recovery` | Bootstrap replica from another cluster |

## Backup Methods

| Method | Status | Details |
|--------|--------|---------|
| `barmanObjectStore` | **Deprecated** (removed v1.30) | S3/GCS/Azure via Barman Cloud |
| `volumeSnapshot` | Current | CSI snapshots (recommended for Ceph, EBS, etc.) |
| `plugin` | Current | CNPG-I gRPC plugin for backup/WAL/recovery |

## Affinity / Scheduling Patterns

- **nodeSelector** — Pin to specific node (common for stateful workloads)
- **podAntiAffinity** — Spread replicas across nodes (`required` for HA, `preferred` for soft)
- **topologySpreadConstraints** — Distribute across zones
- **tolerations** — For tainted nodes (GPU, infra-only)

Set per-instance overrides via `instances` + `nodeSelector` to pin specific roles.

## ImageCatalog (v1.29+)

```yaml
apiVersion: postgresql.cnpg.io/v1
kind: ClusterImageCatalog
metadata:
  name: postgres-extensions
spec:
  images:
    - image: ghcr.io/my-org/postgres:18-pgvector
      major: 18
```

Then reference in Cluster: `spec.imageCatalogRef: postgres-extensions`

## Common Mistakes

- **BarmanObjectStore as default** \u2014 deprecated, use `volumeSnapshot` or `plugin`
- **No WAL storage** \u2014 important for HA. Add `walStorage` block for performance
- **`resizePVC: false`** \u2014 prevents storage expansion on Helm upgrade
- **`primaryUpdateStrategy: supervised`** \u2014 requires manual approval for switchover; use `unsupervised` for automatic
- **Same storageClass for all workloads** \u2014 ceph-block fine for most, but immich needs local-fast for vector extension performance
- **Missing `INHERITED_ANNOTATIONS` / `INHERITED_LABELS`** \u2014 empty is fine; only set if you want annotations propagated to PVCs

## Version Mapping

From Aidas-dev/k8s-agent-skills, MIT.

More from Aidas-dev/k8s-agent-skills

Signals

Stars
4
Forks
3
Open issues
0
Last commit (this folder)
Jul 16, 2026 (3 months ago)
Last release
Aug 14, 2026 (2 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from Aidas-dev

Cite this page

cnpg skill. Agent Mart. https://agentmart.dev/skills/aidas-dev-cnpg (last updated 2026-10-24)