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 Enginepage in the Google Cloud console.
-
Click add_box Create.
-
In the Create clusterdialog, click Configurethat is next to Standard cluster mode.
-
In the navigation menu, click Backup planand then select the Enable Backup for GKEcheckbox.
-
Optional: Select the Create backup plancheckbox.
- In the Backup plan namefield, enter a name.
-
From the Regionlist, select a location where the backups to be stored. The Regionslist 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 detailssection displays the plan details with the daily scheduled backups and seven days of retention period by default.
-
Click Edit backup plan detailsto 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 Enginepage in the Google Cloud console.
-
Click add_box Create.
-
In the Create clusterdialog, click Configurethat is next to Autopilot cluster mode.
-
In the navigation menu, click Advanced settings.
-
Click the Backup plansection and select the Create backup plancheckbox.
-
In the Backup plan namefield, enter a name.
-
From the Regionlist, select a location where the backups to be stored. The Regionslist 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 detailssection 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
Enable Backup for GKE on an existing cluster
You can enable Backup for GKE on an existing cluster with Google Cloud CLI, Google Cloud console, or Terraform.
gcloud
To install the Backup for GKE agent, add the --update-addons=BackupRestore=ENABLED
parameter to the gcloud container
clusters update
command.
The following example shows how you can update an existing cluster with the Backup for GKE agent.
gcloud
container
clusters
update
CLUSTER_NAME
\
--project =
PROJECT_ID
\
--location =
LOCATION
\
--update-addons =
BackupRestore
=
ENABLED
Replace the following:
-
CLUSTER_NAME
: the name of the existing cluster. -
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 an existing cluster in the Google Cloud console:
-
Go to the Google Kubernetes Enginepage in the Google Cloud console.
-
In the cluster list, click the name of the cluster you want to modify.
-
Under Features, next to the Backup for GKEfield, click edit Edit Backup for GKE.
-
Select the Enable Backup for GKEcheckbox.
-
Click Save Changes.
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 Enginepage in the Google Cloud console.
-
Click the name of the cluster that you want to inspect.
-
In the Featuressection, verify that Backup for GKEis Enabled.
What's next
- Learn more about defining custom backups .
- Learn more about planning a set of backups .