Kubernetes clusters using generic CSI drivers
PX-Backup supports backup and restore on Kubernetes clusters with generic CSI drivers if the driver meets certain prerequisites.
Prerequisites
Kubernetes prerequisites:
- Kubernetes clusters must be at least version 1.17 to use the Kubernetes CSI Snapshotting Beta feature.
- Kubernetes clusters must have the snapshot-controller version 3.0 or greater. In Kubernetes 1.20, the volume snapshot feature is available. If you use an older version of Kubernetes, then install the snapshot-controller.
The generic CSI driver should implement the following:
- The CSI driver must include the CSI snapshots and restores feature.
- The CSI driver must have the
snapshotter-sidecar
running at version 2.0 or greater. - The CSI driver must have the
external-snapshotter
running at version 2.0 or greater. - Ideally, the CSI driver should implement
ListSnapshots
for indicating that the snapshot is ready to use on the storage backend. - For cross-cluster restores, the CSI drivers for both clusters will need to be connected to the same storage backend. In particular, the
snapshotHandle
used on the source cluster must be visible on the destination cluster via CSIListSnapshots
.
Portworx has tested and recommends the following CSI drivers for use with your Kubernetes clusters:
- Pure Storage PSO CSI Driver
- Openshift OCS RBD CSI Driver
Add the cluster to PX-Backup
From the home page, select Add Cluster:
On the Add Kubernetes Cluster page, enter the cluster details:
- The name of the cluster
- Retrieve the Kubeconfig from your cluster and paste it in the Kubeconfig text frame, or select the Browse button to upload it from a file.
- Select the Others radio button from the Kubernetes Service radio group
Select the Submit button
PX-Backup will add the Kubernetes cluster and create a default VolumeSnapshotClass on it. In some cases, this default VolumeSnapshotClass will work with no further configuration. If it doesn’t, you must configure it by adding your generic CSI driver’s parameters.
Attempt a backup on your newly added cluster from the PX-Backup UI. If it fails, proceed to the Add CSI driver specific parameters section.
Add CSI driver specific parameters
If you’ve added the cluster to PX-Backup and successfully performed a backup, skip this section. If you attempted a backup unsuccessfully, you must add some parameters to the VolumeSnapshotClass
to allow PX-Backup to perform backups and restores with your generic CSI driver.
See your CSI driver documentation to determine which parameters you need in your VolumeSnapshotClass. If the CSI driver you’re using requires VolumeSnapshotClass
parameters in order to function correctly, you must create or update this object.
Perform the following steps to edit the default VolumeSnapshotClass for your CSI driver:
Verify that the VolumeSnapshotClass exists:
kubectl get volumesnapshotclass <snapshotclass>
List the CSI driver(s) for your volumes and retain the driver name for use in the next step:
kubectl get csidrivers
Edit the VolumeSnapshotClass object for your CSI driver by saving the driver name as an environment variable called
CSI_DRIVER_NAME
and entering thekubectl edit
command shown below:CSI_DRIVER_NAME=<csi_driver_name> kubectl edit volumesnapshotclass stork-csi-snapshot-class-${CSI_DRIVER_NAME}
Add the necessary parameters to this object based on the documentation for your CSI driver(s).
PX-Backup will now use these VolumeSnapshotClass parameters when performing backups and restores. Verify that you’ve configured the VolumeSnapshotClass successfully by running another backup from the PX-Backup UI.
VolumeSnapshotClass
with a deletion policy as retain
to prevent data loss.