Chapter 8. 3scale backup and restore using custom resources
This chapter includes details about the backup and restore functionality for a Red Hat 3scale API Management installation deployed using the APIManager custom resource (CR). In this context, the CRD is provided by the 3scale operator.
Custom resources from operator capabilities are not part of the 3scale installation. For this reason, the custom resources are not included as part of the 3scale installation backup and restore functionality.
3scale backup and restore using operators is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process. For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.
Prerequisites
- A 3scale installation
The following sections contain the procedures to perform 3scale backup and restore using the operator.
8.1. Backing up 3scale using the operator
The following section provides the information and procedure you require to backup a 3scale installation that was deployed by an APIManager custom resource.
8.1.1. Backup compatible scenarios
To see the 3scale installation configurations that can be backed up, see the following sections:
Prerequisites
Backup the 3scale external databases:
-
backend-redis
-
system-redis
-
system-database
- MySQL or PostgreSQL
-
- Provision enough space for the PVC to contain the data backed up.
A 3scale deployment, which is deployed using APIManager cannot be backed up using S3 as System’s FileStorage.
8.1.2. Backup scenarios scope
Backup functionality is available when the following databases are configured externally:
- Backend Redis database
- System Redis database
- System database - MySQL or PostgreSQL
8.1.3. Backed up data
The following table shows a list of the data that is backed up.
Object | Object-type data |
---|---|
Secrets |
|
ConfigMaps |
|
APIManager | APIManager custom resource Kubernetes object definition - json schema definition |
System FileStorage | When the location of System FileStorage is in a PersistentVolumeClaim (PVC) |
8.1.4. Backing up 3scale
To backup a 3scale installation deployed with an existing APIManager, use the following steps:
Procedure
Backup the following Kubernetes secrets:
-
backend-redis
-
system-redis
-
system-database
-
Create the
APIManagerBackup
custom resource in the same namespace where the 3scale installation managed by the APIManager object is deployed, as in example one:Example 1
apiVersion: apps.3scale.net/v1alpha1 kind: APIManagerBackup metadata: name: example-apimanagerbackup-pvc spec: backupDestination: persistentVolumeClaim: resources: requests: "10Gi"
Example 2 provides a pre-existing PersistentVolume name:
apiVersion: apps.3scale.net/v1alpha1 kind: APIManagerBackup metadata: name: example-apimanagerbackup-pvc spec: backupDestination: persistentVolumeClaim: # resources specification is required but ignored when providing a volumeName as per K8s PVCs requirements behavior resources: requests: "10Gi" volumeName: "my-preexisting-persistent-volume"
-
Wait until
APIManagerBackup
finishes. Check this by obtaining the content ofAPIManagerBackup
and waiting until the.status.completed
field is set to true.
The backup contents is detailed in Backed up data.
Other fields in the status section of the APIManagerBackup
show details of the backup, such as the name of the PVC where the data has been backed up when the configured backup destination has been a PVC.
For future references, take note of the value of status.backupPersistentVolumeClaimName
field. When restoring an APIManager installation with APIManagerRestore
, one of the fields it requires is the PersistentVolumeClaimName
backup source.
8.2. Restoring 3scale using the operator
The following section provides the information and procedure you require to restore a 3scale installation that was previously deployed by an APIManager custom resource and backed up by APIManagerBackup
.
8.2.1. Restore compatible scenarios
To see the 3scale installation configurations that can be restored, see the following sections:
Prerequisites
Restore the 3scale external databases:
-
backend-redis
-
system-redis
-
system-database
- MySQL or PostgreSQL
-
8.2.2. Restore scenarios scope
The restore functionality of the 3scale operator is available using a backup generated from an APIManagerBackup
custom resource.
For a list of the 3scale solution scenarios you can backup, see Backed up data for reference.
The following are not in the scope of the restore functionality of the operator:
-
Restoring backup data that was not performed using an
APIManagerBackup
custom resource. -
Restoring backup data provided through an
APIManagerBackup
from different 3scale versions.
8.2.3. Restored data
The following table shows a list of the data that is restored.
Object | Object-type data |
---|---|
Secrets |
|
ConfigMaps |
|
APIManager | APIManager custom resource Kubernetes object definition - json schema definition |
System FileStorage | When the location of System FileStorage is in a PersistentVolumeClaim (PVC) |
Routes | 3scale-related OpenShift routes, for example master and tenants |
8.2.4. Restoring 3scale
To restore a 3scale installation previously deployed with an APIManager that was backed up using an APIManagerBackup
custom resource, follow these steps:
- Ensure that the project where you are performing the restoration does not contain an APIManager custom resource and its corresponding 3scale installation.
Restore the following Kubernetes secrets:
-
backend-redis
-
system-redis
-
system-database
-
Create the
APIManagerRestore
custom resource and specify the backup data of the installation that was previously backed up by anAPIManagerBackup
custom resource.For details, see Backup scenarios scope.
The following is an example of an
APIManagerRestore
custom resource:apiVersion: apps.3scale.net/v1alpha1 kind: APIManagerRestore metadata: name: example-apimanagerrestore-pvc spec: restoreSource: persistentVolumeClaim: claimSource: claimName: example-apimanagerbackup-pvc # Name of the PVC produced as the backup result of an `APIManagerBackup` readOnly: true
Wait until
APIManagerRestore
finishes. Check this by obtaining the content ofAPIManagerRestore
and waiting until the.status.completed
field is set to true.You should see a new APIManager custom resource has been created and a 3scale installation deployed.