This documentation is for a release that is no longer maintained.
You can select a different version or view all RHACS documentation.Chapter 1. Backing up Red Hat Advanced Cluster Security for Kubernetes
You can perform data backups for Red Hat Advanced Cluster Security for Kubernetes and use these for data restoration in case of an infrastructure disaster or corrupt data.
You can configure automatic backups for the Central database by integrating with Amazon S3, S3 API compatible services, or Google Cloud Storage. You can perform on-demand backups of the Central database by using the roxctl CLI. You can also back up your Central deployment using RHACS Operator or Helm Chart installation methods.
Depending on your requirements, you can create two types of backups:
- A backup of the Central database: It includes RHACS configurations, resources, events, and certificates. In an unforeseen incident, such as database failure or data corruption, you can use the backup to recover and restore the Central database to its earlier functional state. Doing this ensures the availability and integrity of essential data, allowing you to continue normal operations without significant disruptions or loss of critical information.
- A backup of all custom deployment configurations: If you installed RHACS by using Helm charts or the RHACS Operator, you can back up settings, parameters, and customizations specific to your installation. When the RHACS installation gets accidentally deleted, or you need to migrate it to another cluster or namespace, having a backup of the deployment configurations enables a seamless recovery process. In addition, by restoring the custom settings from the backup, you can efficiently reinstate your Central installation’s unique requirements and configurations, ensuring consistent and exact deployment of the system.
1.1. Backup considerations for external databases and cloud users Copy linkLink copied to clipboard!
You must manage your backups differently if you use an external database or if you are a cloud user.
Back up with an external database
If you use an external database, you cannot use the automatic backup option or start a backup process from within Red Hat Advanced Cluster Security for Kubernetes (RHACS).
- When you upgrade your external database, you must scale down Central before you start the backup. Central attempts to connect to the database until it is successful, which can cause issues during the upgrade process.
- For a database that you manage, you must use the backup procedures that your database vendor recommends.
Back up for cloud users
If you are a cloud user, you cannot use the automatic backup option or start the backup process from an integration. Red Hat is responsible for backing up your data.
1.1.1. Backing up your PostgreSQL database and certificates Copy linkLink copied to clipboard!
By backing up your Red Hat Advanced Cluster Security for Kubernetes (RHACS) instance with an external PostgreSQL database, you can ensure the security and integrity of your data by following a vendor-recommended procedure. In this process, you back up the PostgreSQL database first, and then back up the RHACS certificates.
Procedure
To back up the PostgreSQL database, run the following command:
pg_dump -U <username> -d <database_name> -f <output_file_path>
$ pg_dump -U <username> -d <database_name> -f <output_file_path>Copy to Clipboard Copied! Toggle word wrap Toggle overflow where:
<username>- Specifies the name of the user who has the necessary permissions to perform the dump.
<database_name>- Specifies the actual name of the database.
<output_file_path>- Specifies the desired location and name for your backup file.
To back up the RHACS certificates, run the following command:
roxctl central backup --certs-only=true
$ roxctl central backup --certs-only=trueCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Because backup files include secrets and certificates, you must securely store the backup files.
1.2. Backing up Central database by using the roxctl CLI Copy linkLink copied to clipboard!
Backing up the Central database is critical to ensure data integrity and system reliability. Regular backups of the database, containing necessary configurations, resources, events, and certificates, protect against database failures, corruption, and accidental data loss.
You can use the roxctl CLI to take the backups by using the backup command. You require an API token or your administrator password to run this command.
Red Hat supports backups for the Central database through integration with Amazon S3 or Google Cloud Storage.
Backing up to S3 API compatible storage is not guaranteed to work. Red Hat does not test and support every S3 API compatible provider for backing up RHACS.
1.2.1. On-demand backups by using an API token Copy linkLink copied to clipboard!
You can back up the entire database of RHACS by using an API token.
Prerequisites
-
You have an API token with the
Adminrole. -
You have installed the
roxctlCLI.
Procedure
Set the
ROX_API_TOKENand theROX_ENDPOINTenvironment variables by running the following commands:export ROX_API_TOKEN=<api_token>
$ export ROX_API_TOKEN=<api_token>Copy to Clipboard Copied! Toggle word wrap Toggle overflow export ROX_ENDPOINT=<address>:<port_number>
$ export ROX_ENDPOINT=<address>:<port_number>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Initiate a backup for Central by running the following command:
roxctl central backup
$ roxctl central backup1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- You can use the
--outputoption to specify the backup file location.
By default, the
roxctlCLI saves the backup file in the directory where you run the command.
1.2.2. On-demand backups by using the administrator password Copy linkLink copied to clipboard!
You can back up the entire database of RHACS by using your administrator password.
Prerequisites
- You have the administrator password.
-
You have installed the
roxctlCLI.
Procedure
Set the
ROX_ENDPOINTenvironment variable by running the following command:export ROX_ENDPOINT=<address>:<port_number>
$ export ROX_ENDPOINT=<address>:<port_number>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Initiate a backup for Central by running the following command:
roxctl -p <admin_password> central backup
$ roxctl -p <admin_password> central backup1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- For
<admin_password>, specify the administrator password.
By default, the
roxctlCLI saves the backup file in the directory in which you run the command. You can use the--outputoption to specify the backup file location.
1.3. Backing up Central deployment Copy linkLink copied to clipboard!
You can back up the deployment of a Central instance. This can be useful if you want to migrate central to another namespace or cluster by using the same configuration values.
Red Hat does not support backing up deployment configurations by using the roxctl CLI. You can use the oc or kubectl CLI to back up manifests related to your Central instance and restore the configuration.
1.3.1. Backing up deployment using the RHACS Operator Copy linkLink copied to clipboard!
When you use the RHACS Operator to instal RHACS, OpenShift Container Platform stores all the custom configuration for your Central deployment within the Central custom resource. You can backup the Central custom resource, the central-tls secret, and the administrator password. The central-tls secret includes the certificates for authenticating with Secured clusters and signing API tokens.
Procedure
Run the following command to save the Central custom resource in a YAML file:
oc get central -n _<central-namespace>_ _<central-name>_ -o yaml > central-cr.yaml
$ oc get central -n _<central-namespace>_ _<central-name>_ -o yaml > central-cr.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Run the following command to save
central-tlsin a JSON file:oc get secret -n _<central-namespace>_ central-tls -o json | jq 'del(.metadata.ownerReferences)' > central-tls.json
$ oc get secret -n _<central-namespace>_ central-tls -o json | jq 'del(.metadata.ownerReferences)' > central-tls.jsonCopy to Clipboard Copied! Toggle word wrap Toggle overflow Run the following command to the administrator password in a JSON file:
oc get secret -n _<central-namespace>_ central-htpasswd -o json | jq 'del(.metadata.ownerReferences)' > central-htpasswd.json
$ oc get secret -n _<central-namespace>_ central-htpasswd -o json | jq 'del(.metadata.ownerReferences)' > central-htpasswd.jsonCopy to Clipboard Copied! Toggle word wrap Toggle overflow
1.3.2. Backing up deployment using Helm Copy linkLink copied to clipboard!
When you use the Helm chart to install RHACS, you store all the custom configuration for your Central deployment within the custom values that you apply to the Helm chart.
You can back up the custom values and save it in a YAML file.
Procedure
Run the following command to back up custom Helm chart values in a YAML file:
helm get values --all -n _<central-namespace>_ _<central-helm-release>_ -o yaml > central-values-backup.yaml
$ helm get values --all -n _<central-namespace>_ _<central-helm-release>_ -o yaml > central-values-backup.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow