Skip to content

Backup Policy

Administrators can create a backup policy to specify how, when and what needs to be backed up. The policy will define the location to keep the backup data, retention period, whether persistent volumes should be backed up and the scope of cluster objects to backup.


Create Backup Policy

Follow the steps described below to create a backup policy for your clusters:

  • From the controller's web console, select "Backup/Restore"-> Policies
  • Add "New Policy" and provide a name and optionally a description
  • Select Type "Backup"

Add Backup Policy

  • In the Backup Policy Settings page > Config section, select the Control Plane Backup Location from the dropdown list.
  • If you would like to backup the persistent volumes associated with the cluster, select the Volume Backup Location from the dropdown list.
  • Enter the Retention Period for your backup data.

Note

You can "backup" the control plane and the PVs to different locations.


Control Plane and PVs

Here is an example of a configuration which will backup both "cluster control plane data" and "persistent volumes" with a 10-day retention period. Note that the "control plane" and the "PVs (volumes)" are backed up to different locations.

Configure Backup Policy


Control Plane Only

Here is an example of a configuration which will backup ONLY the "cluster control plane data" with a 10-day retention period. Persistent volumes will not be backed up.

Configure Backup Policy


Advanced Options

You can optionally use "target selectors" to refine the scope of the backup policy. You have three options

  • Include namespaces (backups performed only from the selected namespaces)
  • Exclude namespaces (backups from selected namespaces are skipped)
  • Specify label selectors (backup resources that match the labels)

Here is an illustrative example where the administrator wants to backup ALL cluster data except "kube-system", "rafay-infra" and "rafay-system" namespaces.

Configure Backup Policy


RCTL for Backup Policy

Administrators can also create a backup policy through RCTL using the below commands to specify how, when and what needs to be backed up

Create Backup Policy

.rctl create dp-policy <name> --type <backup> --location <location> --snapshot-location <snapshot-location> --retention-period <period> --include-namespace <include-ns> --exclude-namespace <exclude-ns> --label-selector <key:value,key:"",key:value>

Delete Policy

.rctl delete dp-policy <name>

Fetch Policy

.rctl get dp-policy

An illustrative example is shown below where RCTL retrieves the list of policies

+--------------+---------+------------------------------+
| NAME         | TYPE    | CREATED AT                   |
+--------------+---------+------------------------------+
| demo-backup  | Backup  | Fri Sep 17 09:26:45 UTC 2021 |
+--------------+---------+------------------------------+
| demo-restore | Restore | Fri Sep 17 09:27:08 UTC 2021 |
+--------------+---------+------------------------------+
| demo-bp      | Backup  | Fri Sep 17 09:27:19 UTC 2021 |
+--------------+---------+------------------------------+

Use the below command to retrieve a specific policy details

.rctl get dp-policy <policy-name>

Update Backup Policy

.rctl update dp-policy <name> --type <backup> --location <location> --snapshot-location <snapshot-location> --retention-period <period> --include-namespace <include-ns> --exclude-namespace <exclude-ns> --label-selector <key:value,key:"",key:value>