This page describes how to enable Backup for GKE for a cluster.
You can enable Backup for GKE for Standard and Autopilot 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 or Autopilot clusters.
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 Standard cluster
You can enable Backup for GKE for a Standard cluster with the Google Cloud CLI, Google Cloud console, or Terraform.
gcloud
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 \
--location=LOCATION \
--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.LOCATION
: the Compute Engine region or zone for the cluster, for exampleus-central1
.
Console
Use the following instructions to enable Backup for GKE for a Standard cluster in the Google Cloud console:
Go to the Google Kubernetes Engine page in the Google Cloud console.
Click add_box Create.
In the Create cluster dialog, click Configure that is next to Standard cluster mode.
In the navigation menu, click Backup plan and then select the Enable Backup for GKE checkbox.
Optional: Select the Create backup plan checkbox.
- In the Backup plan name field, enter a name.
From the Region list, select a location where the backups to be stored. The Regions list displays the regions where Backup for GKE is supported. For a list of Backup for GKE supported regions, see Backup for GKE locations.
The Backup plan details section displays the plan details with the daily scheduled backups and seven days of retention period by default.
Click Edit backup plan details to update backup plan details.
Click Create.
Terraform
Enable using a gke_backup_agent_config
entry in your
google_container_cluster
resource:
resources "google_container_cluster" "primary" {
name = "my_cluster"
...
addons_config {
gke_backup_agent_config {
enabled = true
}
}
}
For more information, see container_cluster gke_backup_agent_config
Enable Backup for GKE for a Autopilot cluster
You can enable Backup for GKE for a Autopilot cluster with the Google Cloud CLI, Google Cloud console, or Terraform.
gcloud
To install the Backup for GKE agent, add the following parameter:
sh
--enable-backup-restore
to the Google Cloud CLI cluster creation command.
The following example shows how you can create a autopilot cluster with the Backup for GKE agent installed:
gcloud container clusters create-auto CLUSTER_NAME \
--project=PROJECT_ID \
--location=LOCATION \
--release-channel=RELEASE_CHANNEL \
--enable-backup-restore
Replace the following:
CLUSTER_NAME
: the name of the cluster to back up.PROJECT_ID
: the ID of your Google Cloud project.LOCATION
: the Compute Engine region or zone for the cluster, for exampleus-central1
.RELEASE_CHANNEL
: the name of the release channel for the cluster. The default isRegular
.
Console
Use the following instructions to enable Backup for GKE for a Autopilot cluster in the Google Cloud console:
Go to the Google Kubernetes Engine page in the Google Cloud console.
Click add_box Create.
In the Create cluster dialog, click Configure that is next to Autopilot cluster mode.
In the navigation menu, click Advanced settings.
Click the Backup plan section and select the Create backup plan checkbox.
In the Backup plan name field, enter a name.
From the Region list, select a location where the backups to be stored. The Regions list displays the regions where Backup for GKE is supported. For a list of Backup for GKE supported regions, see Backup for GKE locations.
Click Create.
The Backup plan details section displays the plan details with the daily scheduled backups and seven days of retention period by default.
Terraform
Enable using a gke_backup_agent_config
entry in your
google_container_cluster
resource:
resources "google_container_cluster" "primary" {
name = "my_cluster"
enable_autopilot = true
...
addons_config {
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 \
--location=LOCATION
Replace the following:
CLUSTER_NAME
: the name of the cluster.PROJECT_ID
: the ID of your Google Cloud project.LOCATION
: the Compute Engine region or zone for the cluster, for exampleus-central1
.
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:
Go to the Google Kubernetes Engine page in the Google Cloud console.
Click the name of the cluster that you want to inspect.
In the Features section, verify that Backup for GKE is Enabled.
What's next
- Learn more about defining custom backups.
- Learn more about planning a set of backups.