This page describes how to enable
[Backup for GKE](https://docs.cloud.google.com/kubernetes-engine/docs/add-on/backup-for-gke/concepts/backup-for-gke.md.txt).

## Before you begin


Before you start, make sure that you have performed the following tasks:

- Enable the Google Kubernetes Engine API.
[Enable Google Kubernetes Engine API](https://console.cloud.google.com/apis/enableflow?apiid=container.googleapis.com)
- To use the Google Cloud CLI for this task, [install](https://docs.cloud.google.com/sdk/docs/install) and then [initialize](https://docs.cloud.google.com/sdk/docs/initialize.md.txt) the gcloud CLI. If you previously installed the gcloud CLI, get the latest version by running the `gcloud components update` command. Earlier gcloud CLI versions might not support running the commands in this document.

  > [!NOTE]
  > **Note:** For existing gcloud CLI installations, make sure to set the `compute/region` [property](https://docs.cloud.google.com/sdk/docs/properties.md.txt#setting_properties). If you use primarily zonal clusters, set the `compute/zone` instead. By setting a default location, you can avoid errors in the gcloud CLI like the following: `One of [--zone, --region] must be supplied: Please specify location`. You might need to specify the location in certain commands if the location of your cluster differs from the default that you set.

\* Ensure that you have the [Service Usage Admin](https://docs.cloud.google.com/iam/docs/roles-permissions/serviceusage.md.txt#serviceusage.serviceUsageAdmin) (`roles/serviceusage.serviceUsageAdmin`) role on your project. This role is required to enable the Backup for GKE API.

<br />

## Enable the Backup for GKE API

The Backup for GKE service is automatically enabled in any project where the
GKE API is enabled. This lets you to improve the data protection
posture of your GKE clusters by making use of the
Backup for GKE service.

Enabling the Backup for GKE API alone doesn't modify any existing GKE
cluster configurations or affect the running workloads. Also, it doesn't
automatically create backups or incur additional costs. Costs are only incurred
when you create and store backups using the Backup for GKE service.

If you manually disabled the Backup for GKE
service, you can enable the Backup for GKE service by using the
Google Cloud CLI, Google Cloud console, or Terraform.

### gcloud

To enable the Backup for GKE service, run the following command:

```bash
gcloud services enable gkebackup.googleapis.com
```

### Console

In the Google Cloud console, enable the Backup for GKE API:

[Enable the API](https://console.cloud.google.com/apis/library/gkebackup.googleapis.com)

### Terraform

Create an appropriate `"google_project_service"` resource to
enable the `gkebackup.googleapis.com` service:

    resource "google_project_service" "my_service" {
       project = "my_project"
       service = "gkebackup.googleapis.com"
    }

For more information, see [google_project_service](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/google_project_service).

## What's next

- Learn more about [defining custom backups](https://docs.cloud.google.com/kubernetes-engine/docs/add-on/backup-for-gke/how-to/protected-application.md.txt).
- Learn more about [planning a set of backups](https://docs.cloud.google.com/kubernetes-engine/docs/add-on/backup-for-gke/how-to/backup-plan.md.txt).