Skip to main content

Backup & Restore vCluster Platform

This guide describes how to backup and restore the vCluster Platform management plane. For backing up the connected clusters, please reuse a regular Kubernetes backup solution such as velero.

vCluster Platform saves its state as Kubernetes CRD objects. These can be either backed up via velero or through a special vCluster CLI command that we have created for convenience that saves all relevant Kubernetes resources to a single file. vCluster CLI allows you to backup these components whenever required. Below Resources will be part of the backup:

  • ClusterRoleTemplates
  • ClusterAccesses
  • SpaceConstraints
  • Users
  • Teams
  • SharedSecrets
  • AccessKeys
  • Apps
  • SpaceTemplates
  • VirtualClusterTemplates
  • Clusters & Cluster Secrets
  • Projects
  • VirtualClusterInstances
  • SpaceInstances
  • ProjectSecrets

To take a backup using the defaults, you can run the following command. This will dump the manifests of all the above listed components to a file in the current directory named 'backup.yaml'

vcluster platform backup management

Alternatively, you may specify the name for the backup file by running the command as:

vcluster platform backup management --filename vcluster-platform-backup.yaml

In some scenarios, vCluster Platform may have been installed in a different namespace instead of the default vcluster-platform namespace. You can provide this to the command as below:

vcluster platform backup management --namespace my-namespace

You can also choose to exclude certain components from the backup by supplying the names as a comma-seperated string like below. This will exclude users and teams from the backup.

vcluster platform backup management --skip users,teams

Restoring vCluster Platform from backup

The backup YAML file contains the manifests for the resources of the vCluster Platform Management plane. Hence, it can be used as any other Kubernetes manifest file. To restore, simply apply the backup to your cluster using the below command:

note

The backup contains vCluster Platform custom resource definitions (CRDs) that will have to be installed in the cluster for the restore to succeed.

kubectl apply -f <backup-filename>.yaml

Note that you will likely see lots of warning messages similar to the following:

Warning: resource apps/argocd is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically.

These are just warnings and should not affect the restoration task!

Multiple Kubernetes Clusters with the same vCluster Platform Config

Make sure that you are not installing vCluster Platform (and vCluster Platform Agents) into cluster(s) with vCluster Platform already running! Multiple vCluster Platform instances running on the same cluster(s) can lead to conflicts in reconciliation and could cause unexpected problems!