Backup process for Kubernetes

Commvault supports snapshot-based and streaming backups for Kubernetes workloads. This topic describes backup scopes, backup methods, data protection workflows, and failure handling.

Backup scope

The backup scope determines which Kubernetes resources are protected.

Scope Resources protected
Full cluster All namespaces, including system namespaces, and cluster-scoped API resources.
Namespace All API resources in the selected namespace. Namespaces can be selected by label or by browsing the cluster. This is the default scope for applications.
Application An individual Pod, DaemonSet, Deployment, StatefulSet, or Helm Chart, along with related resources such as Secrets, ConfigMaps, and Namespaces.

Backup methods

Full-cluster, namespace, and application backups use a method based on the cluster configuration.

Cluster configuration Backup method How data is backed up
A VolumeSnapshotClass object is configured Snapshot-based Creates Container Storage Interface (CSI) snapshots of persistent volumes and reads the data from temporary PVCs.
No VolumeSnapshotClass object is configured Streaming Reads persistent volume data through temporary pods.

Streaming backups

Streaming is the legacy backup method for clusters without a VolumeSnapshotClass object. This method is supported only for application backups.

The software performs the following actions automatically:

  1. Discovers applications based on the application group content.

  2. Creates a temporary pod in the backup namespace for each PVC associated with an application. It mounts the volume and reads data through the Kubernetes API server.

  3. Deletes the temporary pod after the backup completes.

Snapshot-based backups for applications

Commvault discovers applications based on the application group content. For each PersistentVolumeClaim (PVC) associated with a protected application, the software performs the following actions:

  1. Selects the VolumeSnapshotClass associated with the source PVC's StorageClass.

  2. Creates a VolumeSnapshot of the PVC.

  3. Creates a temporary PVC from the snapshot. By default, the temporary PVC uses the same StorageClass as the source PVC.

  4. Mounts the temporary PVC in a temporary pod and reads the data through the Kubernetes API server.

  5. Deletes the temporary pod, VolumeSnapshot, and temporary PVC after the backup completes.

Snapshot creation runs in parallel across applications. Within an application, the access node creates volume snapshots sequentially and then protects them in parallel. The persistent volumes are not backed up as a consistency group.

Optional snapshot settings

Use the following labels to override the default snapshot settings. Replace the placeholders in each command with your class names before running it.

Select a VolumeSnapshotClass

To use a specific VolumeSnapshotClass, set the cv-snapshotter label on the source PVC's StorageClass:

kubectl patch storageclass <storageclass-name> --patch '{"metadata":{"labels":{"cv-snapshotter":"<volumesnapshotclass-name>"}}}'
  • <storageclass-name>: The StorageClass of the source PVC.

  • <volumesnapshotclass-name>: The VolumeSnapshotClass to use for snapshots.

Select a StorageClass for temporary PVCs

To use a specific StorageClass for temporary PVCs, set the cv-backup-storageclass label on the VolumeSnapshotClass:

kubectl patch volumesnapshotclass <volumesnapshotclass-name> --patch '{"metadata":{"labels":{"cv-backup-storageclass":"<storageclass-name>"}}}'
  • <volumesnapshotclass-name>: The VolumeSnapshotClass used for snapshots.

  • <storageclass-name>: The StorageClass to use for temporary PVCs.

Snapshot-based backups for VMs

Commvault protects virtual machines (VMs) running on OpenShift Virtualization (KubeVirt) by using CSI snapshots and an access node running inside the cluster. Backups are crash-consistent and run outside the guest operating system. No in-guest packages are required, and backup data is read without adding processing overhead inside the VM.

Each VM disk is backed by a DataVolume that maps to a PVC. The PVC is the unit of protection.

The software performs the following actions automatically:

  1. Queries the Kubernetes API server to discover VirtualMachine and VirtualMachineInstance resources. It collects the namespace, labels, VM configuration metadata, and associated disks.

  2. Creates a storage-native CSI snapshot for each disk's PVC. The software briefly freezes and unfreezes the VM to maintain consistency without requiring VM downtime.

  3. Creates a temporary PVC from each snapshot. Each temporary PVC represents a point-in-time copy of a VM disk.

  4. Attaches the temporary PVC to the access node running in the cluster. This provides access to the snapshot data without affecting the original VM.

  5. Reads data from the mounted volume and streams it to the MediaAgent.

  6. Unmounts the volume and deletes the temporary PVCs and snapshots after the backup completes.

Failure handling

The following default behavior applies to Kubernetes backup and restore jobs.

Failure scenario Default behavior
Application backup or restore fails The Kubernetes access node restarts the application-specific job from the beginning with a new temporary worker pod. Data from the failed attempt is discarded and transferred again.
Child Kubernetes access node fails Operations running on that node are rescheduled on another access node.
Coordinator Kubernetes access node fails The job is marked as partially or completely failed without restarting it.
Temporary worker pod fails The job is not restarted and is marked as Completed with Errors.

Default restart settings

Restarts are enabled by default for all job types. The following defaults apply when a backup or restore job can be restarted.

Job type Maximum restarts Restart interval
Backup 10 20 minutes
Restore 144 20 minutes

Kubernetes jobs use the Virtual Server Agent. For more information about job restarts, see Job Status and Control for Virtual Machines.

Temporary resources after an interruption

If a backup or restore is interrupted, the access node might not be able to remove temporary VolumeSnapshots, volumes, and worker pods.

For cleanup guidance, see "Cleanup of Temporary Resources" in Restrictions and Known Issues for Kubernetes.

Storage snapshotter failure

If the CSI external snapshotter pod fails, snapshot commands fail and the Kubernetes API server reports the failures. The affected container backup fails, and Commvault attempts to restart the application snapshot job five times.

The outcome depends on whether snapshots were created:

  • Snapshots already exist: The backup proceeds, but cleanup of temporary PVCs and snapshots might fail. The cleanup guidance in the preceding section applies.

  • Snapshots do not exist: The backup job fails without another restart attempt.

×

Loading...