Set up a GCP VPC peering connection

Uses: Kong Gateway
TL;DR

Use Konnect to initiate peering, then create a GCP VPC peering resource to accept connections from Konnect.

Prerequisites

This is a Konnect tutorial that requires Dedicated Cloud Gateways access.

If you don’t have a Konnect account, you can get started quickly with our onboarding wizard.

  1. The following Konnect items are required to complete this tutorial:
    • Personal access token (PAT): Create a new personal access token by opening the Konnect PAT page and selecting Generate Token.
    • Dedicated Cloud Gateway Control Plane Dedicated Cloud Gateway: You can use an existing Dedicated Cloud Gateway or create a new one to use for this tutorial.
    • Network ID: The default Dedicated Cloud Gateway network ID can be found in Gateway Manager > Network
  2. Set these values as environment variables:
     export KONNECT_TOKEN='YOUR KONNECT TOKEN'
     export KONNECT_NETWORK_ID='KONNECT NETWORK ID'
    

Set up a GCP account with the Compute Network Admin role (roles/compute.networkAdmin) or the following custom permissions:

  • compute.networks.addPeering
  • compute.networks.updatePeering
  • compute.networks.removePeering
  • compute.networks.listPeeringRoutes

Initiate the VPC peering connection

Create a VPC peering resource in GCP

Make sure that your VPC ranges don’t conflict with the Cloud Gateway Network VPC range.

The peering connection status will initially show as Initializing and should change to Ready once peering is successfully established on both GCP and Kong.

Validation

To validate that everything was configured correctly, issue a GET request to the /transit-gateways endpoint to retrieve VPC peering information:

 curl -X GET "https://global.api.konghq.com/v2/cloud-gateways/networks/$KONNECT_NETWORK_ID/transit-gateways" \
     -H "Authorization: Bearer $KONNECT_TOKEN"
Something wrong?

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!