This page describes how to use VPC Service Controls to protect Backup for GKE
resources. For more information about VPC Service Controls, read the [Overview of VPC Service Controls](https://docs.cloud.google.com/vpc-service-controls/docs/overview.md.txt).

## Before you begin

Ensure that you have the [required IAM permissions](https://docs.cloud.google.com/vpc-service-controls/docs/access-control.md.txt) to
administer VPC Service Controls.

## Create a service perimeter to protect Backup for GKE resources

1. In the Google Cloud console, go to the **VPC Service Controls** page.

   [Go to VPC Service Controls](https://console.cloud.google.com/security/service-perimeter)
2. If you are prompted, select your Organization.

3. On the **VPC Service Controls** page, click **New Perimeter**.

4. On the **New VPC Service Perimeter** page, in the **Perimeter Name** box,
   type a name for the perimeter.

5. Select the projects that you want to secure within the perimeter:

   1. Click **Add Projects** button.

   2. To add a project to the perimeter, in the **Add Projects** dialog, select that project's checkbox.

   3. Click **Add <var translate="no">n</var> Projects** button, where <var translate="no">n</var> is
      the number of projects you selected in the previous step.

6. Select Backup for GKE to secure within the perimeter:

   1. Click **Add Services** button.

   2. To secure Backup for GKE within the perimeter, in the
      **Specify services to restrict** dialog, select Backup for GKE's
      checkbox.

   3. Click **Add Backup for GKE API** button.

7. Click **Save** button.

You've created a service perimeter that restricts access to Backup for GKE
resources. The service perimeter may take up to 30 minutes to propagate and take
effect. When the changes have propagated, access to Backup for GKE will be
limited for the projects you added to the perimeter. For example, no backup plan
or backup can be created from outside of the perimeter, unless otherwise explicitly allowed by an ingress rule.

## Details about how Backup for GKE works with service perimeters

1. If Backup for GKE is not among the list of VPC accessible services of a
   service perimeter, backup and restore may fail even if you are able to create
   backup or restore using the Google Cloud console or gcloud CLI. This
   is because the Backup for GKE agent is running in your GKE
   cluster (within the service perimeter) and requires access to
   Backup for GKE to perform backup and restore.

2. To perform cross-project backups and restores successfully, the
   `backup_project`, `cluster_project`, and `restore_project` should be within
   the same VPC Service Controls perimeter.