Skip to content

[Bug]: Backup in mode volumeSnapshot doesn't archive WalStorage #9053

Closed

Description

@DerTim1

Is there an existing issue already for this bug?

  • I have searched for an existing issue, and could not find anything. I believe this is a new bug.

I have read the troubleshooting guide

  • I have read the troubleshooting guide and I think this is a new bug.

I am running a supported version of CloudNativePG

  • I have read the troubleshooting guide and I think this is a new bug.

Contact Details

No response

Version

1.27 (latest patch)

What version of Kubernetes are you using?

1.33

What is your Kubernetes environment?

Cloud: Azure AKS

How did you install the operator?

Helm

What happened?

We used kubectl cnpg backup timescale-cluster -m volumesnapshot -n timescale to backup a postgres single server with separate WalStorage (both pvc realeased as Azure SSD v2 Premium), or used a Backup-resource to create a volume snapshot backup, but, only the main storage is backuped, not the wal pvc.

If we want to restore via bootstrap: recovery: ... we see the error message, that there is no snapshot present from the wal pvc:

cannot create primary instance PVCs: missing StorageSource for PostgreSQL WAL

The following volumeSnapshot was created (we did it two times):

$ kubectl get volumesnapshot -n timescale
NAME                               READYTOUSE   SOURCEPVC             SOURCESNAPSHOTCONTENT   RESTORESIZE   SNAPSHOTCLASS   SNAPSHOTCONTENT                                    CREATIONTIME   AGE
timescale-cluster-20251103141054   true         timescale-cluster-1                           256Gi         azure-disk      snapcontent-f18755a5-5628-4641-98fb-9bf626e44adb   42h            42h
timescale-cluster-20251104115600   true         timescale-cluster-1                           256Gi         azure-disk      snapcontent-4609cea0-21c1-4e74-8bb6-e10195b0a1b9   20h            20h

(the wal should be a snapshot with 64Gi).

Is there another way to restore via volume snapshot with enabled walStorage (additional pvc)? We also setup walArchiver via barman-plugin. We are able to restore from this too, but want to use volumeSnapshots (database size will reach 5 TB on production system).

Thanks for your advice.

Cluster resource

# Server with backup
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: timescale-cluster
  namespace: timescale
  labels:
    app: timescale-cluster
spec:
  instances: 1
  enablePDB: false
  imageCatalogRef:
    apiGroup: postgresql.cnpg.io
    kind: ImageCatalog
    name: timescaledb-pg16-ts2.21
    major: 16
  postgresUID: 1000
  postgresGID: 1000
  enableSuperuserAccess: true
  
  certificates:
    serverTLSSecret: timescale-server-cert
    serverCASecret: timescale-server-cert

  bootstrap:
    initdb:
      database: timescale
      owner: timescale
      dataChecksums: true
      localeCollate: "en_US.UTF-8"
      localeCType: "en_US.UTF-8"
      encoding: "UTF8"
      secret:
        name: timescale-secret
      postInitSQL:
        - "CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE VERSION '2.21.3'"
      postInitApplicationSQL:
        - "CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE VERSION '2.21.3'"

  managed:
    roles:
      - name: devops
        comment: Admin User
        superuser: true
        login: true
        passwordSecret:
          name: timescale-devops-secret
      - name: timescale
        createdb: true
        login: true
        passwordSecret:
          name: timescale-secret
      - name: timescale_reader
        login: true
        passwordSecret:
          name: timescale-reader-secret
  resources:
    limits:
      memory: 56Gi

  storage:
    size: 8Ti
    storageClass: ssd-v2-premium-12kiops-retain
  walStorage:
    size: 256Gi
    storageClass: ssd-v2-premium-12kiops-retain

  postgresql:
    shared_preload_libraries:
      - "pgaudit"
      - "timescaledb"
    parameters:
      ...
    pg_hba:
      - host all all 0.0.0.0/0 md5
      - host all all ::0/0 md5

  backup:
    volumeSnapshot:
       className: azure-disk
       walClassName: azure-disk
  plugins:
    - name: barman-cloud.cloudnative-pg.io
      isWALArchiver: true
      parameters:
        barmanObjectName: azure-store
---
# Restore Server
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: tomescale-cluster
  namespace: timescale
  labels:
    app: tomescale-cluster
spec:
  instances: 1
  enablePDB: false
  imageCatalogRef:
    apiGroup: postgresql.cnpg.io
    kind: ImageCatalog
    name: timescaledb-pg16-ts2.21
    major: 16
  postgresUID: 1000
  postgresGID: 1000
  enableSuperuserAccess: true

  certificates:
    serverTLSSecret: tomescale-server-cert
    serverCASecret: tomescale-server-cert
  bootstrap:
    recovery:
      source: timescale-cluster
      # backup:
      #   name: timescale-cluster-20251103141054
      volumeSnapshots:
        storage:
          name: timescale-cluster-20251103141054
          kind: VolumeSnapshot
          apiGroup: snapshot.storage.k8s.io
        walStorage:
          name: timescale-cluster-20251103141054
          kind: VolumeSnapshot
          apiGroup: snapshot.storage.k8s.io
      recoveryTarget:
        targetTime: "2025-11-03T22:00:00"
      database: timescale
      owner: timescale
  externalClusters:
    - name: timescale-cluster
      plugin:
        name: barman-cloud.cloudnative-pg.io
        parameters:
          barmanObjectName: azure-store
          serverName: timescale-cluster

  managed:
    roles:
      - name: devops
        comment: Admin User
        superuser: true
        login: true
        passwordSecret:
          name: timescale-devops-secret
      - name: timescale
        createdb: true
        login: true
        passwordSecret:
          name: timescale-secret
      - name: timescale_reader
        login: true
        passwordSecret:
          name: timescale-reader-secret
  resources:
    limits:
      memory: 8Gi

  storage:
    size: 256Gi
    storageClass: ssd-v2-premium-12kiops-retain

  walStorage:
    size: 64Gi
    storageClass: ssd-v2-premium-12kiops-retain

  postgresql:
    shared_preload_libraries:
      - "pgaudit"
      - "timescaledb"
    parameters:
      ...
    pg_hba:
      - host all all 0.0.0.0/0 md5
      - host all all ::0/0 md5

Relevant log output

cannot create primary instance PVCs: missing StorageSource for PostgreSQL WAL

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added
    triage
    on Nov 5, 2025
  2. dosubot commented on Nov 5, 2025

    @dosubot

    Hi @DerTim1! I'm Dosu and I’m helping the cloudnative-pg team.

    CloudNativePG is designed to create volume snapshots for both the main data PVC and the WAL PVC when walStorage is configured and the storage class supports snapshots. If only the main storage PVC is being snapshotted and not the WAL PVC, this usually points to a configuration or environment issue rather than a known bug in 1.27.

    Make sure that:

    • The walStorage PVC is provisioned with a storage class that supports volume snapshots on Azure AKS.
    • The backup.volumeSnapshot.walClassName is set to the correct VolumeSnapshotClass for your WAL PVC (it defaults to className if not set).
    • The operator has permissions to create VolumeSnapshots for both PVCs and that there are no errors or warnings in the operator logs during backup.
    • There are no backup reconciliation issues or failing backups on other clusters that could block snapshot creation for your target cluster.

    If the WAL PVC snapshot is missing, restore will fail with the error you saw, as both snapshots are required for clusters with separate walStorage. There is no workaround to restore from volume snapshots alone without the WAL PVC snapshot; you must use WAL archiving (e.g., barman-cloud) for PITR or full recovery in that case.

    For more details and troubleshooting steps, see the official documentation and related issues. Double-check your VolumeSnapshotClass and CSI driver support for both PVCs, and review operator logs for any errors during backup.

    To reply, just mention @dosu.


    Docs are dead. Just use Dosu.

    Leave Feedback Ask Dosu about cloudnative-pg Share Dosu with your team

  3. DerTim1 commented on Nov 7, 2025

    @DerTim1
    Author

    Our pvc for the wal was messed up a little bit (missing labels and annotations). The cluster was able to use this pvc, but for volume snapshot the labels are required.

    The hint was the status "waiting for instances to become active" of cluster resource, despite the cluster worked as expected.
    After adding labels and annotations to wal pvc again (during a hibnerate phase) the cluster returned to healthy state and backup with mode volumesnapshot also creates snapshot from wal storage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

triage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions