Enable Backup for GKE for a cluster


This page describes how to enable Backup for GKE for a cluster.

You can enable Backup for GKE for Standard clusters in the following ways:

  • During cluster creation or updates with the Cloud console, gcloud, or Terraform.
  • Automatically enabled when you create your first backup plan or restore plan for Standard Google Kubernetes Engine cluster.

You can enable Backup for GKE for Autopilot clusters in the following ways:

  • During cluster creation or updates with the gcloud or Terraform. You cannot enable it from the Cloud console.
  • Automatically enabled when you create your first backup plan or restore plan for Autopilot Google Kubernetes Engine cluster.

Enabling Backup for GKE during cluster creation is preferable as it saves time and is faster to create a cluster with the agent installed than to create the cluster and then enable the agent.

Enable Backup for GKE for a cluster

You can enable Backup for GKE for a cluster with the Google Cloud CLI, Google Cloud console, or Terraform.

gcloud

This option is available for both Standard and Autopilot Google Kubernetes Engine clusters.

To install the Backup for GKE agent, add the following parameter: sh --addons=BackupRestore to the Google Cloud CLI cluster creation command.

The following example shows how you can create a 1.24 cluster with the Backup for GKE agent installed:

gcloud container clusters create CLUSTER_NAME \
    --project=PROJECT_ID  \
    --region=COMPUTE_REGION \
    --cluster-version=1.24.2-gke.1900 \
    --addons=BackupRestore

Replace the following:

  • CLUSTER_NAME: the name of the cluster to back up.
  • PROJECT_ID: the ID of your Google Cloud project.
  • COMPUTE_REGION: the Compute Engine region for the cluster, for example us-central1. For zonal clusters, use --zone=COMPUTE_ZONE instead.

Console

This option is only available for Standard Google Kubernetes Engine clusters.

Use the following instructions to enable Backup for GKE on a new cluster in the Google Cloud console:

  1. Go to the Google Kubernetes Engine page in the Google Cloud console.

    Go to Google Kubernetes Engine

  2. Click Create.

  3. Click Switch to Standard cluster and do the following:

    1. Specify a name and location for the cluster.
    2. In the navigation menu, click Features page and then select the Enable Backup for GKE checkbox.
    3. Click Create.

Terraform

This option is available for both Standard and Autopilot Google Kubernetes Engine clusters.

Enable using a gke_backup_agent_config entry in your google_container_cluster resource:

resources "google_container_cluster" "primary" {
   name = "my_cluster"
   ...
   gke_backup_agent_config {
      enabled = true
   }
}

For more information, see container_cluster gke_backup_agent_config

Verify that Backup for GKE is enabled on your cluster

You can verify that your cluster is using Backup for GKE with the gcloud CLI or the Google Cloud console.

gcloud

Verify that Backup for GKE is enabled for your cluster:

gcloud container clusters describe CLUSTER_NAME \
    --project=PROJECT_ID  \
    --region=COMPUTE_REGION

Replace the following:

  • CLUSTER_NAME: the name of the cluster.
  • PROJECT_ID: the ID of your Google Cloud project.
  • COMPUTE_REGION: the Compute Engine region for the cluster, for example us-central1. For zonal clusters, use --zone=COMPUTE_ZONE instead.

If Backup for GKE is enabled, the output of the command includes these lines:

addonsConfig:
  gkeBackupAgentConfig:
    enabled: true

Console

Perform the following tasks in the Google Cloud console:

Use the following instructions to verify Backup for GKE for a cluster in the Google Cloud console:

  1. Go to the Google Kubernetes Engine page in the Google Cloud console.

    Go to Google Kubernetes Engine

  2. Click the name of the cluster that you want to inspect.

  3. In the Features section, verify that Backup for GKE is Enabled.

What's next