Skip to content

Rate this page
Thanks for your feedback
Thank you! The feedback has been submitted.

Get free database assistance or contact our experts for personalized support.

Making on-demand backups

An on-demand backup is a backup that you start manually at any time. You create a Backup resource and the Operator uses it to make a backup. A backup can be any of the supported backup types.

If you want to run backups automatically, according to the schedule, see Make scheduled backups tutorial.

Here’s what you need to do to run on-demand backups:

Modify the Custom Resource manifest

  1. Edit the deploy/cr.yaml configuration file and specify the following configuration:

    • Set the backup.enabled key to true,

    • Check that you have defined at least one configured storage in the backup.storages subsection.

  2. Apply the changes. Don’t forget to replace the <namespace> placeholder with your namespace:

    kubectl apply -f deploy/cr.yaml -n <namespace>
    

Create a Backup resource

To create a Backup resource, you need a special custom resource manifest. The deploy/backup/backup.yaml is the example manifest that you can use.

  1. Specify the following configuration:

    • metadata.name is the name of the backup. You will need this name when you restore from this backup. The default name is backup1.

    • spec.clusterName is the name of your cluster (prior to the Operator version 1.12.0 this key was named spec.psmdbCluster). Run kubectl get psmdb -n <namespace> to find out the cluster name.

    • spec.storageName is the name of your already configured storage.

    • spec.type is the backup type. If you leave it empty, the Operator makes a logical backup by default.

    Examples

    apiVersion: psmdb.percona.com/v1
    kind: PerconaServerMongoDBBackup
    metadata:
      finalizers:
      - percona.com/delete-backup
      name: backup1
    spec:
      clusterName: my-cluster-name
      storageName: s3-us-west
      type: logical
    
    apiVersion: psmdb.percona.com/v1
    kind: PerconaServerMongoDBBackup
    metadata:
      finalizers:
      - percona.com/delete-backup
      name: backup1
    spec:
      clusterName: my-cluster-name
      storageName: s3-us-west
      type: physical
    

    To make incremental backups, consider the following:

    1. Make the incremental base backup first. The Operator needs the base to start the chain of increments and save only changes from previous backup.

    2. Use the same storage for base backup and increments.

    3. The percona.com/delete-backup finalizer is considered for incremental base backup but is ignored for increments. This means that when a base backup is deleted, PBM deletes all increments that derive from it.

    There is the limitation that the Backup resource for the base incremental backup is deleted but the Backup resources for increments remain in the Operator. This is because the Operator doesn’t control their deletion outsourcing this task to PBM. This limitation will be fixed in future releases.

    Here’s the configuration example for the base incremental backup

    apiVersion: psmdb.percona.com/v1
    kind: PerconaServerMongoDBBackup
    metadata:
      finalizers:
      - percona.com/delete-backup
      name: backup1
    spec:
      clusterName: my-cluster-name
      storageName: s3-us-west
      type: incremental-base
    

    This configuration example is for subsequent incremental backups:

    apiVersion: psmdb.percona.com/v1
    kind: PerconaServerMongoDBBackup
    metadata:
      name: backup1
    spec:
      clusterName: my-cluster-name
      storageName: s3-us-west
      type: incremental
    
  2. Apply the backup.yaml manifest to start a backup:

    kubectl apply -f deploy/backup/backup.yaml
    
  3. You can track the backup process with the PerconaServerMongoDBBackup Custom Resource as follows:

    kubectl get psmdb-backup
    
    Expected output
    NAME      CLUSTER           STORAGE      DESTINATION                                  TYPE      SIZE       STATUS   COMPLETED   AGE
    backup1   my-cluster-name   s3-us-west   s3://my-bucket/2025-09-23T10:34:59Z   logical   105.44MB   ready    43m       43m
    

    It should show the status as READY when the backup process is over.

Troubleshooting

If you have any issues with a backup, see Troubleshoot backups and restores.

Restore to a new Kubernetes environment

To restore from a backup to a new Kubernetes-based environment, you must create a Secrets object there with the same user passwords as in the original cluster.

Find the Secrets name object on the source cluster in the spec.secrets key in the `deploy/cr.yaml. Use this name to recreate the Secrets on the target cluster.

Find more details about secrets in System Users.


Last update: July 22, 2026
Created: July 22, 2026