Backup repository

The backup repository stores application and configuration data (for example, namespaces and applications) and enables rapid restoration from backup files. Each backup repository is a Velero BackupStorageLocation (BSL) in the cpaas-system namespace of the cluster where you back up or restore applications.

WARNING

The Backup Repository Management tab is deprecated. It is still supported, but it will be removed in a future release and is not recommended for new deployments. Create a BSL directly in the target cluster, as described in this topic.

Prerequisites

  • Data Backup is installed on the target cluster. For installation instructions, see application installation.
  • You have kubectl access to the target cluster with permissions to create Secrets and BackupStorageLocations in the cpaas-system namespace.
  • An S3-compatible object storage bucket is available, together with its access keys.

Create a backup repository

Run the following steps on the cluster where you want to back up or restore applications. To use the same repository on several clusters, repeat the steps on each cluster.

  1. Create a Secret that stores the access keys of the object storage.

    export SECRET_ID="your-secret-id"
    export SECRET_KEY="your-secret-key"
    
    kubectl create secret generic <bsl-name>-credential \
      --from-literal=cloud="$(printf '[default]\naws_access_key_id = %s\naws_secret_access_key = %s\n' "$SECRET_ID" "$SECRET_KEY")" \
      --dry-run=client -n cpaas-system -o yaml | \
      kubectl label --local -f - component=velero -o yaml | kubectl apply -f -
  2. Create a BackupStorageLocation that references the Secret. Save the following YAML to a file, and then run kubectl apply -f <file>.

    apiVersion: velero.io/v1
    kind: BackupStorageLocation
    metadata:
      name: <bsl-name>
      namespace: cpaas-system
      labels:
        cpaas.io/backup-storage-location-repo: <bsl-name> # Required. Set the value to the BSL name.
    spec:
      provider: aws
      credential:
        name: <bsl-name>-credential
        key: cloud
      objectStorage:
        bucket: <bucket>
        prefix: <folder>                  # Optional.
        # caCert: <base64-encoded CA certificate> # Optional.
      config:
        region: <region>
        s3Url: <endpoint>
        s3ForcePathStyle: "false"
        insecureSkipTLSVerify: "false"
        checksumAlgorithm: ""
    WARNING

    The cpaas.io/backup-storage-location-repo label is required, and its value must be the name of the BSL. Without this label, the platform treats the BSL as a legacy repository and synchronizes it to all clusters that have Data Backup installed. The label value is also displayed as the repository name when you select a backup repository on the Backup and Recovery page.

    FieldDescription
    metadata.nameName of the backup repository. The value of the cpaas.io/backup-storage-location-repo label must be the same as this name.
    spec.objectStorage.bucketName of the storage bucket.
    spec.objectStorage.prefixBucket folder prefix used to store backup data, for example backups.
    spec.objectStorage.caCertIf CA verification is required, the Base64-encoded CA certificate, for example the output of base64 < ca.crt | tr -d '\n'.
    spec.config.regionThe region of the object storage data center. For MinIO, enter minio.
    spec.config.s3UrlThe external access address (HTTP REST API) of the object storage. Use the service endpoint, for example https://cos.<region>.myqcloud.com. Do not use the public bucket domain that includes the bucket name, for example https://<bucket name>.cos.<region>.myqcloud.com.
    spec.config.s3ForcePathStyleAddressing method. Set to "false" for virtual-hosted–style addressing (object storage). Set to "true" for path-style addressing (file storage and MinIO).
    spec.config.insecureSkipTLSVerifySet to "true" to skip certificate verification if the object storage does not use a valid certificate.
    spec.config.checksumAlgorithmKeep the empty value to disable request checksums, which some S3-compatible storages do not support.
  3. Verify that the backup repository is available.

    kubectl -n cpaas-system get backupstoragelocation <bsl-name>

    The repository is ready when PHASE is Available. Only available repositories can be selected when you create backup schedules or recovery tasks. If PHASE is Unavailable, check the Velero logs:

    kubectl -n cpaas-system logs -l name=velero --tail=-1 | grep <bsl-name>

Delete a backup repository

If a backup schedule references the repository, deleting it will cause backup failures when the schedule runs. Update the backup schedule to reference another repository before deletion.

Deleting a backup repository does not delete the backup data in the object storage.

NOTE

The following commands apply only to backup repositories created as described in this topic. Delete backup repositories that were created on the web console, including repositories migrated from earlier versions, on the web console. Otherwise, the platform re-creates them. For instructions, see Delete a backup repository on the web console.

kubectl -n cpaas-system delete backupstoragelocation <bsl-name>
kubectl -n cpaas-system delete secret <bsl-name>-credential

Manage backup repositories on the web console (deprecated)

WARNING

This feature is deprecated. It is still supported, but it will be removed in a future release and is not recommended for new deployments. Use the procedures above instead.

Backup repositories created on the web console are synchronized to all clusters that have Data Backup installed.

Create a backup repository on the web console

  1. In the left navigation, click Clusters > Backup and Recovery.

  2. Switch to the Backup Repository Management tab.

  3. Click Create Backup Repository and configure the parameters as follows.

    ParameterDescription
    RegionThe region of the object storage data center. Tip: For MinIO, enter "minio".
    Addressing StyleAddressing method. Defaults: virtual-hosted–style for object storage; path-based for file storage and MinIO integration.
    EndpointThe external access address (HTTP REST API) of the object storage. Use the service endpoint, for example https://cos.<region>.myqcloud.com. Caution: Do not use the public bucket domain (which includes the bucket name), for example https://<bucket name>.cos.<region>.myqcloud.com.
    BucketName of the storage bucket.
    FolderBucket folder prefix used to store backup data, for example backups.
    Secret Id/Secret KeyAccess keys for authenticating to the object storage.
    Skip TLS VerifyIf the external storage does not use a valid certificate, enable this option to skip certificate verification.
    CA CertificateIf CA verification is required, upload the Base64-encoded CA certificate.
  4. Click Create.

Delete a backup repository on the web console

  1. In the left navigation, click Clusters > Backup and Recovery.

  2. Switch to the Backup Repository Management tab.

  3. Click the Delete button on the right of the backup repository, and then click Delete to confirm the deletion.