Backups on OPCP
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.
Filesystem backups (configuration files and etcd snapshots) are available from OPCP v3.2.
Requirements
- A delivered and operational On-Prem Cloud Platform service
- SSH access to the OPCP controller with a user allowed to use
sudo(the commands in this guide run asroot, viasudo -i) - An S3-compatible object storage outside the platform, with the buckets and credentials described in "Backup configuration"
- If you manage the platform yourself, knowledge of
opcp-cli(see How to manage the OPCP configuration with opcp-cli)
Instructions
Backup architecture
OPCP uses three independent mechanisms. Each one writes to its own bucket.
Filesystem backups
restic backs up files from the controller's local filesystem. Two resources are enabled by default:
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:
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:
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 understringData); - apply the changes with
sudo opcp-cli deploy --system.
On an OVHcloud-managed platform, request the change through your usual support channel.
Configuration reference
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.
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:
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:
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:
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.
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:
The Velero backup location can take a few minutes to become Available.
Data retention
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
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:
List the clusters with kubectl get cluster -A. To back up all of them at once:
Velero backups
Create a backup from a schedule. --wait blocks until it completes:
To back up from all the schedules at once:
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:
restic asks for the repository password (the value of config_backups_encryption_secret), then lists the snapshots:
Database backups
A successful backup is in the completed phase.
Velero backups
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:
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:
-
Give the controller a user with read and write permissions only, using advanced resource access management:
-
Turn on versioning on the bucket.
-
Set
controller_fs.defaults.retentiontofalse, and theretentionof every resource that overrides it: the controller can no longer delete the expired backups. -
Clean up from a separate host, unreachable from OPCP, with separate credentials. Run
restic forgetandrestic pruneperiodically (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:
- the encryption password of the filesystem backups (see "Credentials and encryption");
- the KMS unseal shares (see "What is not backed up");
- the IDs of the backups to restore (see "Listing the available backups").
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
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.