For AI agents: the complete documentation index is available at https://docs.ovhcloud.com/en/llms.txt, the full documentation bundle is available at https://docs.ovhcloud.com/en/llms-full.txt, and this page is available as Markdown at https://docs.ovhcloud.com/en/guides/hosted-private-cloud/opcp/backup-overview.md.
Skip to content

Backups on OPCP

View as Markdown

Find out how OPCP backs up its control plane with restic, CloudNativePG and Velero: configuration, retention, triggering and listing

Objective

Your OVHcloud On-Prem Cloud Platform (OPCP) backs up its control plane to an external S31-compatible object storage. These backups let you recover from physical or logical failures of the controller.

They do not cover any other data, such as the data and workloads stored on the OPCP nodes.

This guide describes what is backed up, how the backups are configured, how long they are kept, and how to trigger and list them. Restoring is covered in How to restore OPCP from a backup.

Warning

Filesystem backups (configuration files and etcd snapshots) are available from OPCP v3.2.

Requirements

Instructions

Backup architecture

OPCP uses three independent mechanisms. Each one writes to its own bucket.

MechanismToolWhat is backed upScheduleBucket
Filesystem backupsresticConfiguration files, etcd snapshotsDailybackups.controller_fs.resources.<name>.s3_bucket
Database backupsCloudNativePG (Barman)Every PostgreSQL database of the control planeHourlybackups.db.bucket
Velero backupsVelero (Kopia)OpenTofu state, KMS auto-unsealer shares, selected persistent volumesHourlybackups.pv.bucket

Filesystem backups

restic backs up files from the controller's local filesystem. Two resources are enabled by default:

ResourceContent
opcp-configThe platform configuration and secrets: /opt/opcp/config and /opt/opcp/secrets
etcd-snapshotsThe snapshots of the etcd database of the controller's Kubernetes cluster

Each resource runs as a systemd service triggered by a timer on the controller: opcp-config-backup.service and etcd-snapshots-backup.service. The backups are encrypted with the config_backups_encryption_secret secret (see "Credentials and encryption").

To add your own resources (see "Filesystem backup settings").

Database backups

The internal databases are PostgreSQL clusters managed by CloudNativePG.

Each cluster has a ScheduledBackup resource. CloudNativePG sends the backups and the write-ahead logs to the barmanObjectStore, which points to the backups.db.bucket bucket.

Velero backups

Velero backs up Kubernetes resources and volumes. Three schedules are defined:

ScheduleContent
tfstate-backupThe OpenTofu state. OPCP uses it during setup, for example to configure IAM.
kms-autounsealer-shares-backupThe KMS auto-unsealer shares: secrets needed to unseal the secrets management system
pvs-backupSelected persistent volumes: Glance images (glance-images), Ironic shared data (ironic-shared), the KMS SQLite volume (ovhcloud-ssm-sqlite) and the Grafana storage, which holds your custom dashboards

The volume data is uploaded with Kopia, into one backup repository per namespace.

What is not backed up

  • The data and workloads on the nodes. Back them up separately.
  • The KMS unseal shares. The KMS is based on Shamir's secret sharing: the secret is split into three shares, two of which are required to decrypt it. These shares are highly sensitive, so OPCP does not back them up. Without them, you cannot restore the KMS.

Export the shares once, and store them outside OPCP, ideally in your trusted password manager:

touch kms-shares-backup.yaml
for i in {1..3}; do
  echo "---" >> kms-shares-backup.yaml
  kubectl -n kms get secret ovhcloud-kms-share-${i} -o yaml >> kms-shares-backup.yaml
done

Once the file is stored outside OPCP, delete kms-shares-backup.yaml from the controller.

Backup configuration

The backups are configured in the backups section of the platform configuration (/opt/opcp/config/opcp-deployment-config.yaml).

On a self-managed platform:

  • edit the settings with sudo opcp-cli config edit;
  • edit the credentials with sudo opcp-cli secrets passwords --edit (keys under stringData);
  • apply the changes with sudo opcp-cli deploy --system.

On an OVHcloud-managed platform, request the change through your usual support channel.

Configuration reference

backups:
  endpoint:
    url: "url.of.your.s3.service"     # S3 endpoint, outside the platform
    region: yourRegion
  db:                                 # database backups
    enabled: true
    retention: "30d"
    bucket: "opcp01-backups-db-region"
  pv:                                 # Velero backups
    enabled: true
    retention: "720h0m0s"             # persistent volumes
    bucket: "opcp01-backups-pv-region"
    tfState:
      retention: "720h0m0s"
    kmsShares:
      retention: "720h0m0s"
  controller_fs:                      # filesystem backups
    enabled: true
    defaults:
      retention: "3m"
    resources:
      opcp-config:
        enabled: true
        s3_bucket: opcp01-fs-backups-region/opcp-config        # bucket/optional-prefix
      etcd-snapshots:
        enabled: true
        s3_bucket: opcp01-fs-backups-region/etcd-snapshots
KeyDescription
endpoint.url / endpoint.regionURL and region of the S3-compatible service. Shared by all the mechanisms, unless a filesystem resource sets its own s3_url.
db.enabled / db.bucket / db.retentionDatabase backups: switch, bucket and retention
pv.enabled / pv.bucket / pv.retentionVelero backups: switch, bucket and retention of the persistent volumes. The bucket must differ from db.bucket: Velero refuses a bucket that also holds the database backups, and its storage location then stays Unavailable.
pv.tfState.retention / pv.kmsShares.retentionRetention of the OpenTofu state and KMS auto-unsealer shares backups
controller_fs.enabledSwitch for all the filesystem backups
controller_fs.defaultsDefault settings of every filesystem resource. See the "Filesystem backup settings" section.
controller_fs.resources.<name>One filesystem resource. s3_bucket accepts a prefix after the bucket name.

When no bucket is set, OPCP uses generated names: {stage}-{env} for the databases and {stage}-{env}-volumes for Velero. The stage and env values are in the platform configuration.

Warning

Use a separate bucket for each type of backup: filesystem, database and Velero. Do not reuse the Velero bucket for the other backups. Otherwise Velero will throw errors when trying to back up.

To change the endpoint or the buckets of an existing platform, follow How to update the backup S3 buckets: the Velero repositories must be re-initialised.

Credentials and encryption

The following keys of the platform secrets are used by the backups:

Secret keyUse
backup_access_key_idS3 access key. The user needs access to all the backup buckets.
backup_secret_access_keyS3 secret key
config_backups_encryption_secretPassword of the restic repositories (filesystem backups)
Warning

Keep a copy of config_backups_encryption_secret outside OPCP. You need it to restore the filesystem backups, and the copy stored on the controller is itself part of these backups.

To limit what the controller can do with these credentials, see "Securing the backup bucket".

Filesystem backup settings

The controller_fs.defaults settings apply to every resource that does not override them:

backups:
  controller_fs:
    defaults:
      calendar: "*-*-* 02:00:00"     # systemd timer format
      retention: "3m"                 # keep the backups of the last three months
      s3_access_key_id: "{{ backup_access_key_id }}"           # reference to the secret
      s3_secret_access_key: "{{ backup_secret_access_key }}"   # reference to the secret
      pre_scripts: []                 # commands run before the backup
      password_command: "/usr/local/bin/sops decrypt --extract '[\\\"stringData\\\"][\\\"config_backups_encryption_secret\\\"]' /opt/opcp/secrets/controller/common-secret.yaml"
      additional_env:                 # environment of password_command
        SOPS_AGE_KEY_FILE: "/opt/opcp/secrets/opcp-age-key.pem"

Keep the credentials in the secrets and only reference them here. Change password_command only to use another encryption secret.

To back up other directories of the controller, add a resource:

backups:
  controller_fs:
    resources:
      my-backup:
        enabled: true                            # required
        src:                                     # required, one or more paths
          - "/path/to/backup-source"
        s3_bucket: "%{stage}-%{env}-my-bucket"   # required, with an optional prefix
        # s3_url: ""                             # optional, a custom S3 URL
        # Any key of "defaults" can be overridden here.

To disable a resource, set its enabled key to false, for instance controller_fs.resources.etcd-snapshots.enabled. To disable all the filesystem backups, set controller_fs.enabled to false.

Warning

Without the default filesystem backups, you cannot fully restore your OPCP after a disaster.

Checking the configuration

After sudo opcp-cli deploy --system, check each mechanism:

systemd-analyze verify /etc/systemd/system/opcp-config-backup.timer /etc/systemd/system/etcd-snapshots-backup.timer   # filesystem: valid timer files
systemctl list-timers '*-backup*'    # filesystem: one timer per resource
kubectl get scheduledbackup -A       # databases: one ScheduledBackup per cluster
velero backup-location get           # Velero: PHASE must be Available

The Velero backup location can take a few minutes to become Available.

Data retention

BackupSettingDefault
Filesystemcontroller_fs.defaults.retention3 months
Databasesdb.retention30 days
Persistent volumespv.retention30 days
OpenTofu statepv.tfState.retention30 days
KMS auto-unsealer sharespv.kmsShares.retention30 days

Durations are written as days (30d) or as a Go duration (720h0m0s, also 30 days), except the filesystem retention, where 3m means 3 months. Keep the format used by your configuration. To change a value, see "Backup configuration".

Expired filesystem backups are removed by a periodic cleanup job. If you set retention to false, you must remove the old backups yourself (see "Securing the backup bucket").

Triggering a backup

The backups run on their own. Trigger one manually before a risky operation, or to test your configuration.

Filesystem backups

systemctl start opcp-config-backup.service
systemctl start etcd-snapshots-backup.service

Check the result with systemctl status <name>-backup.service. A resource you add under controller_fs.resources has its own <name>-backup.service.

Database backups

Back up one database cluster:

kubectl cnpg backup <db-name> -n <namespace>

List the clusters with kubectl get cluster -A. To back up all of them at once:

kubectl get cluster -A -o jsonpath='{range .items[*]}kubectl cnpg backup {.metadata.name} -n {.metadata.namespace}{"\n"}{end}' | bash

Velero backups

Create a backup from a schedule. --wait blocks until it completes:

velero backup create --from-schedule <schedule-name> --wait

To back up from all the schedules at once:

velero get schedule -o json | jq -r '.items[].metadata.name' | xargs -I{} velero backup create --from-schedule {}

Listing the available backups

Filesystem backups

In Grafana, open the Controller local filesystem backups dashboard. It shows the available backups and their status, with a delay of about 5 minutes after each backup (see Observability on OPCP).

You can also list the snapshots with restic. Set the backup S3 credentials and point it at the S3 URL, bucket and prefix of the resource:

export AWS_ACCESS_KEY_ID="<your-s3-access-key>"
export AWS_SECRET_ACCESS_KEY="<your-s3-secret-key>"
export RESTIC_REPOSITORY="s3:<s3-url>/<bucket>/<prefix>"
restic snapshots

restic asks for the repository password (the value of config_backups_encryption_secret), then lists the snapshots:

ID        Time                 Host         Tags        Paths
-------------------------------------------------------------------------
db2d12a0  2026-10-07 14:18:22  opcp-test-0              /opt/opcp/config
                                                        /opt/opcp/secrets
-------------------------------------------------------------------------
1 snapshots

Database backups

kubectl get scheduledbackup -A    # the schedules
kubectl get backup -A             # the backups, with their phase

A successful backup is in the completed phase.

Velero backups

velero get schedule    # the schedules, with their last backup
velero backup get      # the backups, with their status and expiry

A successful backup has the Completed status and 0 errors.

In the S3 buckets

The commands above show the platform's view. To check that the data really reached the object storage, browse the buckets, for example with s3cmd. First set ACCESS_KEY_ID, SECRET_ACCESS_KEY and REGION, and adapt the values to your provider. If you already use s3cmd, back up your ~/.s3cfg file first, as this block replaces it:

ACCESS_KEY_ID=your-access-key-id # replace with your access key ID
SECRET_ACCESS_KEY=your-access-key-secret # replace with your secret key
REGION=your-s3-region # replace with your region
cat << EOF > ~/.s3cfg
[default]
access_key = ${ACCESS_KEY_ID}
secret_key = ${SECRET_ACCESS_KEY}
bucket_location = ${REGION}
host_base = s3.gra.io.cloud.ovh.net
host_bucket = %(bucket)s.s3.gra.io.cloud.ovh.net
EOF
s3cmd ls s3://<bucket-name>

An empty bucket means the backup configuration is wrong.

The Velero backups are listed under the backups/ prefix of the Velero bucket. The suffix of each name is the date and time of the backup.

Securing the backup bucket

By default, the controller's credentials can delete backups. To protect the filesystem backups against an accidental deletion or ransomware:

  1. Give the controller a user with read and write permissions only, using advanced resource access management:

    {
      "Statement":[{
        "Sid": "RWContainer",
        "Effect": "Allow",
        "Action":["s3:GetObject", "s3:PutObject", "s3:ListBucket", "s3:ListMultipartUploadParts", "s3:ListBucketMultipartUploads", "s3:AbortMultipartUpload", "s3:GetBucketLocation"],
        "Resource":["arn:aws:s3:::<bucket_name>", "arn:aws:s3:::<bucket_name>/*"]
      }]
    }
  2. Turn on versioning on the bucket.

  3. Set controller_fs.defaults.retention to false, and the retention of every resource that overrides it: the controller can no longer delete the expired backups.

  4. Clean up from a separate host, unreachable from OPCP, with separate credentials. Run restic forget and restic prune periodically (see Removing snapshots). With versioning on, these commands only add delete markers: to free the storage, also set a lifecycle rule that expires the noncurrent versions.

You can also add encryption keys to a restic repository with restic key add, for instance one per administrator (see Encryption).

Restoring

OPCP only supports a full restore of the control plane, from all the mechanisms above. You need:

Follow How to restore OPCP from a backup.

Go further

How to restore OPCP from a backup

How to update the backup S3 buckets

How to manage the OPCP configuration with opcp-cli

Observability on OPCP

restic documentation

For training or technical assistance implementing our solutions, contact your sales representative or visit our Professional Services page to request a quote and have your project analysed by our experts.

Join our community of users.

1: S3 is a trademark of Amazon Technologies, Inc. OVHcloud's service is not sponsored by, endorsed by, or otherwise affiliated with Amazon Technologies, Inc.

Was this page helpful?