Backing up Kubernetes persistent volume data to Google Cloud storage

Contributors netapp-tonacki

Complete a few steps to get started backing up data from your persistent volumes on GKE Kubernetes clusters to Google Cloud storage.

Quick start

Get started quickly by following these steps or scroll down to the remaining sections for full details.

One Review prerequisites
  • You have discovered the Kubernetes cluster as a Cloud Manager working environment.

    • Trident must be installed on the cluster, and the Trident version must be 21.1 or greater.

    • All PVCs that will be used to create persistent volumes that you want to back up must have "snapshotPolicy" set to "default".

    • The cluster must be using Cloud Volumes ONTAP on GCP for its' backend storage.

    • The Cloud Volumes ONTAP system must be running ONTAP 9.7P5 or later.

  • You have a valid GCP subscription for the storage space where your backups will be located.

  • You have a service account in your Google Cloud Project that has the predefined Storage Admin role.

  • You have subscribed to the Cloud Manager Marketplace Backup offering, or you have purchased and activated a Cloud Backup BYOL license from NetApp.

Two Enable Cloud Backup on your existing Kubernetes cluster

Select the working environment and click Enable next to the Backup & Restore service in the right-panel, and then follow the setup wizard.

A screenshot that shows the Cloud Backup Enable button which is available after you select a working environment.

Three Define the backup policy

The default policy backs up volumes every day and retains the most recent 30 backup copies of each volume. Change to hourly, daily, weekly, or monthly backups, or select one of the system-defined policies that provide more options. You can also change the number of backup copies you want to retain.

A screenshot that shows the Cloud Backup settings where you can choose your backup schedule and retention period.

Four Select the volumes that you want to back up

Identify which volumes you want to back up in the Select Volumes page. The backup files are stored in a Google Cloud Storage bucket using the same GCP subscription and Region as the Cloud Volumes ONTAP system.

Requirements

Read the following requirements to make sure that you have a supported configuration before you start backing up Kubernetes persistent volumes to Google Cloud storage.

The following image shows each component and the connections that you need to prepare between them:

A diagram showing how Cloud Backup communicates with the volumes on the source systems and the destination storage where the backup files are located.

Note that the Private Endpoint is optional.

Kubernetes cluster requirements
  • You have discovered the Kubernetes cluster as a Cloud Manager working environment. See how to discover the Kubernetes cluster.

  • Trident must be installed on the cluster, and the Trident version must be a minimum of 21.1. See how to install Trident or how to upgrade the Trident version.

  • The cluster must be using Cloud Volumes ONTAP on GCP for its' backend storage.

  • The Cloud Volumes ONTAP system must be in the same GCP region as the Kubernetes cluster, and it must be running ONTAP 9.7P5 or later.

    Note that Kubernetes clusters in on-premises locations are not supported. Only Kubernetes clusters in cloud deployments that are using Cloud Volumes ONTAP systems are supported.

  • All Persistent Volume Claim objects that will be used to create the persistent volumes that you want to back up must have "snapshotPolicy" set to "default".

    You can do this for individual PVCs by adding snapshotPolicy under annotations:

    kind: PersistentVolumeClaim
    apiVersion: v1
    metadata:
      name: full
      annotations:
        trident.netapp.io/snapshotPolicy: "default"
    spec:
      accessModes:
        - ReadWriteMany
      resources:
        requests:
          storage: 1000Mi
      storageClassName: silver

    You can do this for all PVCs associated with a particular backend storage by adding the snapshotPolicy field under defaults in the backend.json file:

    apiVersion: trident.netapp.io/v1
    kind: TridentBackendConfig
    metadata:
      name: backend-tbc-ontap-nas-advanced
    spec:
      version: 1
      storageDriverName: ontap-nas
      managementLIF: 10.0.0.1
      dataLIF: 10.0.0.2
      backendName: tbc-ontap-nas-advanced
      svm: trident_svm
      credentials:
        name: backend-tbc-ontap-nas-advanced-secret
      limitAggregateUsage: 80%
      limitVolumeSize: 50Gi
      nfsMountOptions: nfsvers=4
      defaults:
        spaceReserve: volume
        exportPolicy: myk8scluster
        snapshotPolicy: default
        snapshotReserve: '10'
      deletionPolicy: retain
Supported GCP regions

Cloud Backup is supported in all GCP regions where Cloud Volumes ONTAP is supported.

License requirements

For Cloud Backup PAYGO licensing, a subscription through the GCP Marketplace is required before you enable Cloud Backup. Billing for Cloud Backup is done through this subscription. You can subscribe from the Details & Credentials page of the working environment wizard.

For Cloud Backup BYOL licensing, you need the serial number from NetApp that enables you to use the service for the duration and capacity of the license. Learn how to manage your BYOL licenses.

And you need to have a Google subscription for the storage space where your backups will be located.

GCP Service Account

You need to have a service account in your Google Cloud Project that has the predefined Storage Admin role. Learn how to create a service account.

Enabling Cloud Backup

Enable Cloud Backup at any time directly from the Kubernetes working environment.

Steps
  1. Select the working environment and click Enable next to the Backup & Restore service in the right-panel.

    A screenshot that shows the Cloud Backup Settings button which is available after you select a working environment.

  2. Enter the backup policy details and click Next.

    You can define the backup schedule and choose the number of backups to retain.

    A screenshot that shows the Cloud Backup settings where you can choose your schedule and backup retention.

  3. Select the persistent volumes that you want to back up.

    • To back up all volumes, check the box in the title row (button backup all volumes).

    • To back up individual volumes, check the box for each volume (button backup 1 volume).

      A screenshot of selecting the persistent volumes that will be backed up.

  4. If you want all volumes added in the future to have backup enabled, just leave the checkbox for "Automatically back up future volumes…​" checked. If you disable this setting, you’ll need to manually enable backups for future volumes.

  5. Click Activate Backup and Cloud Backup starts taking the initial backups of each selected volume.

Result

The backup files are stored in a Google Cloud Storage bucket using the same GCP subscription and Region as the Cloud Volumes ONTAP system.

The Kubernetes Dashboard is displayed so you can monitor the state of the backups.

What’s next?

You can start and stop backups for volumes or change the backup schedule.
You can also restore entire volumes from a backup file as a new volume on the same or different Kubernetes cluster in GCP (in the same region).