Regular Backup Operations
Velero provides the following basic administrative functions to back up production clusters:
If you want to back up your cluster in the scope of converting a DKP Essential cluster to a DKP Enterprise Managed cluster, see Back up your Cluster's Applications and Persistent Volumes.
If you require a custom backup location, see how to create one for AWS, Azure, or GCP.
Prepare your Environment
Before you modify a schedule or create an on-demand backup, set the following environment variables:
Specify the workspace namespace of the cluster for which you want to configure the backup:
CODEexport WORKSPACE_NAMESPACE=<workspace_namespace>
Specify the cluster for which you want to create the backup:
CODEexport CLUSTER_NAME=<target_cluster_name>
Set a Backup Schedule
By default, DKP configures a regular, automatic backup of the cluster’s state in Velero. The default settings do the following:
Create daily backups
Save the data from all namespaces
DKP default backups do not support the creation of Volume Snapshots.
These default settings take effect after the cluster is created. If you install DKP with the default platform services deployed, the initial backup starts after the cluster is successfully provisioned and ready for use.
Create Backup Schedules
The Velero CLI provides an easy way to create alternate backup schedules. For example:
velero create schedule <backup-schedule-name> -n ${WORKSPACE_NAMESPACE} \
--kubeconfig=${CLUSTER_NAME}.conf \
--snapshot-volumes=false \
--schedule="@every 8h"
Change Default Backup Service Settings
Check the backup schedules currently configured for the cluster:
CODEvelero get schedules
Delete the
velero-default
schedule:CODEvelero delete schedule velero-default
Replace the default schedule with your custom settings:
CODEvelero create schedule velero-default -n ${WORKSPACE_NAMESPACE} \ --kubeconfig=${CLUSTER_NAME}.conf \ --snapshot-volumes=false \ --schedule="@every 24h"
Create Backup Schedule for a Specific Namespace
You can also create backup schedules for specific namespaces. Creating a backup for a specific namespace can be useful for clusters running multiple apps operated by multiple teams. For example:
velero create schedule <backup-schedule-name> \
--include-namespaces=kube-system,kube-public,kommander \
--snapshot-volumes=false \
--schedule="@every 24h"
The Velero command line interface provides many more options worth exploring. You can also find tutorials for disaster recovery and cluster migration on the Velero community site.
Back up on Demand
In some cases, you might find it necessary to create a backup outside the regularly-scheduled interval. For example, if you are preparing to upgrade any components or modify your cluster configuration, perform a backup before taking that action.
Create a backup by running the following command:
velero backup create <backup-name> -n ${WORKSPACE_NAMESPACE} \
--kubeconfig=${CLUSTER_NAME}.conf \
--snapshot-volumes=false