Hide navigation
Components

Backup

Overview

The backup in Kyma uses Ark.

NOTE: The Ark project was renamed to Velero. The full migration is planned once the new Velero version is available.

Ark backs up Kubernetes resources and stores them in Azure Blob storage. It triggers physical volume snapshots and includes the snapshot references in the backup. Ark can create scheduled or on-demand backups, filter objects to back up, and set time to live (TTL) for stored backups.

For more details, see the official Ark documentation.

Configuration

Ark configuration consists of two custom resources:

  • The VolumeSnapshotLocation CR defines the provider of physical volume snapshots.
  • The BackupStorageLocations CR defines a bucket or storage location for cluster resources.

A Kyma installation provides a set of default snapshot and storage locations. If necessary, you can add custom locations in the heptio-ark Namespace.

A sample BackupStorageLocation configuration file looks as follows:

Click to copy
kind: BackupStorageLocation
metadata:
name: default
namespace: heptio-ark
spec:
config:
resourceGroup: BackupStorage
storageAccount: foo...
objectStorage:
bucket: bucket
provider: azure

For a detailed description of all options, see the Heptio Ark documentation.

A sample VolumeSnapshotLocation configuration file looks as follows:

Click to copy
kind: VolumeSnapshotLocation
metadata:
name: azure-default
namespace: heptio-ark
spec:
config:
apiTimeout: 15m
provider: azure

For a detailed description of all options, see the Heptio Ark documentation.

Back up a Kyma cluster

Kyma provides two validated sample BackupSpec files:

Integrate the these files with your scheduled or on-demand configurations to back up system and user Namespaces.

NOTE: To fully back up a cluster, you must back up both user and system Namespaces.

Modify the files to adjust the backup scope. For details about the file format, see the Ark documentation.

Create manual backups

If you want to use sample backup configurations, you cannot use the Ark CLI. Instead, add the following two Backup custom resources in the heptio-ark Namespace to instruct the Ark server to create a backup. Make sure the indentation is correct.

Sample backup configuration:

Click to copy
---
apiVersion: ark.heptio.com/v1
kind: Backup
metadata:
name: kyma-system-backup
namespace: heptio-ark
spec:
<INCLUDE CONTENT OF SYSTEM NAMESPACE BACKUP FILE HERE>
---
apiVersion: ark.heptio.com/v1
kind: Backup
metadata:
name: kyma-backup
namespace: heptio-ark
spec:
<INCLUDE CONTENT OF USER NAMESPACE BACKUP FILE HERE>

To create the backup, run the following command:

$ kubectl apply -f <filename>

Schedule periodic backups

If you want to use sample backup configurations, you cannot use the Ark CLI. Instead, create two Schedule custom resources in the heptio-ark Namespace to instruct the Ark Server to schedule a cluster backup. Make sure the indentation is correct.

Click to copy
---
apiVersion: ark.heptio.com/v1
kind: Schedule
metadata:
name: kyma-system-backup
namespace: heptio-ark
spec:
template:
<INCLUDE CONTENT OF SYSTEM NAMESPACE BACKUP SPEC HERE>
schedule: 0 1 * * *
---
apiVersion: ark.heptio.com/v1
kind: Schedule
metadata:
name: kyma-backup
namespace: heptio-ark
spec:
template:
<INCLUDE CONTENT OF SYSTEM NAMESPACE BACKUP SPEC HERE>
schedule: 0 1 * * *

To schedule a backup, run the following command:

$ kubectl apply -f <filename>

Backup retention period

To set the retention period of a backup, define the ttl parameter in the BackupSpec definition:

Click to copy
ttl: 24h0m0s

Restore a Kyma cluster

Restoring a Kyma cluster requires a new Kyma installation. As soon as the cluster is up and running, instruct Ark to start the restore process. It is important to restore the system and user Namespaces at the same time to make sure both are in sync.

Use the following command to list available backups:

$ kubectl get backups -n heptio-ark

Sample restore configuration:

Click to copy
---
apiVersion: ark.heptio.com/v1
kind: Restore
metadata:
name: kyma-restore
namespace: heptio-ark
spec:
backupName: null # specify to restore a specific backup
scheduleName: kyma-backup # Applies only if no backup is specified.
restorePVs: true
includeClusterResources: true
---
apiVersion: ark.heptio.com/v1
kind: Restore
metadata:
name: kyma-system-restore
namespace: heptio-ark
spec:
backupName: null # specify to restore a specific backup
scheduleName: kyma-system-backup # Applies only if no backup is specified.
restorePVs: true
includeClusterResources: true

To trigger the restore process, run this command:

$ kubectl apply -f <filename>

To check the restore progress, run the following command:

$ kubectl describe restore -n heptio-ark <restore name>

To validate the result of the restore use the kubectl get command.

NOTE: Even if the restore process is complete, it may take some time for the resources to become available again.