Looker PSC Northbound Regional External L7 ALB

1. Introduction

In this codelab you will create a L7 Regional Application Load Balancer & Private Service Connect Backend to gain northbound access to Looker. Northbound access to Looker requires the Consumer VPC allowlisted to the Looker PSC instance.

Private Service Connect is a capability of Google Cloud networking that allows consumers to access managed services privately from inside their VPC network. Similarly, it allows managed service producers to host these services in their own separate VPC networks and offer a private connection to their consumers. For example, when you use Private Service Connect to access Looker, you are the service consumer, and Google is the service producer, as highlighted in Figure 1.

Figure 1.

145ea4672c3a3b14.png

Southbound access, also known as reverse PSC, enables the Consumer to create a Published Service as a Producer to allow Looker access to endpoints on-premises, in a VPC, to managed services and the Internet. Southbound connections can be deployed in any region, irrespective of where Looker PSC is deployed, as highlighted in Figure 2.

Figure 2.

259493afd914f68b.png

What you'll learn

  • Network requirements
  • Update Looker allowlist for northbound access
  • Create a Private Service Connect backend in the Consumer VPC
  • Google vs. Self Signed certificates

What you'll need

def88091b42bfe4d.png

2. What you'll build

You'll establish an allowlisted Consumer network, looker-psc-demo, to deploy an regional external L7 application load balancer and PSC backend NEG that requires a Google or self-signed certificate. In either method, a registered domain is required that matches the custom domain defined in Looker.

3. Network requirements

Below is the breakdown of network requirements:

Components

Description

VPC (looker-psc-demo)

Custom mode VPC

PSC NEG Subnet

Used to allocate an IP address for the Network Endpoint Group

Proxy Only Subnet

Each of the load balancer's proxies is assigned an internal IP address. Packets sent from a proxy to a backend VM or endpoint has a source IP address from the proxy-only subnet.

Backend Service

A backend service acts as a bridge between your load balancer and your backend resources. In the tutorial, the backend service is associated with the PSC NEG.

4. Codelab topology

7f06f9b9876f76c4.png

5. Setup and Requirements

Self-paced environment setup

  1. Sign-in to the Google Cloud Console and create a new project or reuse an existing one. If you don't already have a Gmail or Google Workspace account, you must create one.

fbef9caa1602edd0.png

a99b7ace416376c4.png

5e3ff691252acf41.png

  • The Project name is the display name for this project's participants. It is a character string not used by Google APIs. You can always update it.
  • The Project ID is unique across all Google Cloud projects and is immutable (cannot be changed after it has been set). The Cloud Console auto-generates a unique string; usually you don't care what it is. In most codelabs, you'll need to reference your Project ID (typically identified as PROJECT_ID). If you don't like the generated ID, you might generate another random one. Alternatively, you can try your own, and see if it's available. It can't be changed after this step and remains for the duration of the project.
  • For your information, there is a third value, a Project Number, which some APIs use. Learn more about all three of these values in the documentation.
  1. Next, you'll need to enable billing in the Cloud Console to use Cloud resources/APIs. Running through this codelab won't cost much, if anything at all. To shut down resources to avoid incurring billing beyond this tutorial, you can delete the resources you created or delete the project. New Google Cloud users are eligible for the $300 USD Free Trial program.

Start Cloud Shell

While Google Cloud can be operated remotely from your laptop, in this codelab you will be using Google Cloud Shell, a command line environment running in the Cloud.

From the Google Cloud Console, click the Cloud Shell icon on the top right toolbar:

55efc1aaa7a4d3ad.png

It should only take a few moments to provision and connect to the environment. When it is finished, you should see something like this:

7ffe5cbb04455448.png

This virtual machine is loaded with all the development tools you'll need. It offers a persistent 5GB home directory, and runs on Google Cloud, greatly enhancing network performance and authentication. All of your work in this codelab can be done within a browser. You do not need to install anything.

6. Before you begin

Enable APIs

Inside Cloud Shell, make sure that your project id is set up:

gcloud config list project
gcloud config set project [YOUR-PROJECT-ID]
project=[YOUR-PROJECT-ID]
region=[YOUR-REGION]
echo $project
echo $region

Enable all necessary services:

gcloud services enable compute.googleapis.com

7. Consumer network

In the following section, you'll create the consumer networking that will be updated in the Looker PSC VPC allowlist.

VPC Network

Inside Cloud Shell, perform the following:

gcloud compute networks create looker-psc-demo --subnet-mode custom

Create Subnets

Inside Cloud Shell, create the consumer network endpoint group subnet:

gcloud compute networks subnets create consumer-psc-neg-subnet --network looker-psc-demo --range 172.16.30.0/28 --region $region --enable-private-ip-google-access

Inside Cloud Shell, create the producer regional proxy only subnet:

gcloud compute networks subnets create $region-proxy-only-subnet \
  --purpose=REGIONAL_MANAGED_PROXY \
  --role=ACTIVE \
  --region=$region \
  --network=looker-psc-demo \
  --range=10.10.10.0/24

Reserve the load balancer's IP address

Inside Cloud Shell, reserve an external IP address for the load balancer:

gcloud compute addresses create regional-alb-static-ip  \
   --region=$region \
   --network-tier=STANDARD

Inside Cloud Shell, view the reserved IP Address:

gcloud compute addresses describe regional-alb-static-ip --region=us-central1 | grep -i address:

Example output:

user@cloudshell$ gcloud compute addresses describe regional-alb-static-ip --region=us-central1 | grep -i address: 
address: 35.208.202.244

8. Create a Custom Domain

The following steps are required to establish a custom domain:

Custom domain example

The custom domain looker.cosmopup.com exists as a public DNS subdomain associated with an A record of the static IP addresses (regional-alb-static-ip) defined earlier. See screenshot taken from a terminal validating the dns lookup.

6be44a9b2536e3f4.png

Next create the customer domain using the subdomain looker.cosmopup.com

5424ce99136d5b3a.png

OAuth example

Below is an example of OAuth credentials for Authorized origins and callback for the subdomain looker.cosmopup.com.

c7e5b8c7d2cc6a01.png

9. Certificates

You can create either Compute Engine or Certificate Manager certificates. Use any of the following methods to create certificates using Certificate Manager:

10. Looker VPC allowlisting

View Allowed VPCs

In the following section, you'll use Cloud Console UI to view the Looker Allowed VPCs list.

In Cloud Console, navigate to:

Looker → Looker Instance → Details

Example below, no entries are in the Allowed VPCs list:

ad33177a2d721ea7.png

Update Allowed VPCs

Update your Looker instance to support northbound access by adding looker-psc-demo as an Allowed VPC.

In Cloud Console, navigate to:

Looker → Looker Instance → Edit

cbbc069688890b82.png

Connections → Allowed VPCs

Ensure to select the project where looker-psc-demo is deployed followed by the VPC looker-psc-demo then Continue.

dc931643e1b220a.png

3e26d16d83cceae9.png

Validate Allowed VPCs

View the update Allowed VPCs list

In Cloud Console, navigate to:

Looker → Looker Instance → Details

e34664c867929c66.png

11. Create PSC Backend

Looker PSC as a Service Producer generates a Service Attachment URI used by Service Consumers to deploy endpoints and backends to gain northbound access to Looker. In the following step, you'll identify the Looker PSC Service Attachment URI followed by creating a Private Service Connect Network Endpoint Group (NEG) backend in the Consumer VPC.

Identify the Looker PSC Service Attachment

In Cloud Console, navigate and copy the Service Attachment URI:

Looker → Looker Instance → Details

a253f94e946a1eef.png

Create the PSC network endpoint group

Inside Cloud Shell, perform the following ensuring to update psc-target-service:

gcloud compute network-endpoint-groups create looker-northbound-neg \
    --network-endpoint-type=private-service-connect \
    --psc-target-service=[UPDATE WITH YOU LOOKER SERVICE ATTACHMENT URI] \
    --region=$region \
    --network=looker-psc-demo \
    --subnet=consumer-psc-neg-subnet

Example:

gcloud compute network-endpoint-groups create looker-northbound-neg \
    --network-endpoint-type=private-service-connect \
 --psc-target-service=projects/t7ec792caf2a609d1-tp/regions/us-central1/serviceAttachments/looker-psc-f51982e2-ac0d-48b1-91bb-88656971c183 \
    --region=$region \
    --network=looker-psc-demo \
    --subnet=consumer-psc-neg-subnet

Validate PSC network end group creation

Inside Cloud Shell, perform the following, ensuing the pscConnectionStatus is accepted:

gcloud compute network-endpoint-groups describe looker-northbound-neg --region=$region | grep -i pscConnectionStatus:

Example:

user@cloudshell$ gcloud compute network-endpoint-groups describe looker-northbound-neg --region=$region | grep -i pscConnectionStatus: 
  pscConnectionStatus: ACCEPTED

Create a regional application load balancer

In the following steps, you'll use Cloud Console to create the regional external application load balancer while associating your generated certificates to the front end configuration.

In Cloud Console, navigate to:

Network Services → Load Balancing → Create Load Balancer

e3474ca153d7c55a.png

Select the following options:

63c2e656953444f2.png

Create the frontend configuration

Select the following options and customize the environment based on your deployment:

  • Region used in deploying the network infrastructure
  • Proxy-Only subnet is auto populated based on your region
  • Previously defined static IP is available based on your region selection

a1c24bd4650b27d3.png

Selecting Certificate, drops down the option to use an existing or new certificate:

aac196a6fa1ee3d5.png

Upload your Certificate and Private Key, then select CREATE:

64a390bda0c9c3f1.png

Select DONE to complete Frontend Configuration:

758a1921e3020854.png

Create the backend configuration

Select the following options:

e9bf17b1277bd597.png

af3b4a59864b15bc.png

6c784cc0169c892b.png

ba3bf9fa7d3497a5.png

Create the routing rules

Select the following options (default options):

8884421f10a50ce0.png

Review and finalize

Verify the configuration and select CREATE:

bdf5793ba8f46bb9.png

The load balancer is now enabled:

61adc0509f07ab15.png

Access the Looker UI

Now that the load balancer is operational, you can access your custom Looker domain through a web browser. It's important to note that you may encounter a warning depending on the type of certificate you're using, e.g. untrusted certificate vs. trusted.

Below is an example (untrusted certificate) of accessing the Looker custom domain looker.cosmopup.com that gains northbound access to the Looker UI:

ae43d0d0d7136044.png

12. Clean up

From a single Cloud Shell terminal delete lab components

gcloud compute forwarding-rules delete regional-external-alb-fr --region=$region -q

gcloud compute target-https-proxies delete regional-external-alb-target-proxy --region=$region -q

gcloud compute url-maps delete regional-external-alb --region=$region -q

gcloud compute backend-services delete looker-psc-neg-backend-svc --region=$region -q

gcloud compute addresses delete regional-alb-static-ip --region=$region -q

gcloud compute network-endpoint-groups delete looker-northbound-neg --region=$region -q

gcloud compute networks delete looker-psc-demo -q

13. Congratulations

Congratulations, you've successfully configured and validated northbound connectivity to Looker using a customer domain and regional external application load balancer.

You made the consumer infrastructure, learned how to create a PSC NEG, custom domain, and got to know the different certificate options. So many exciting things to get you going with Looker.

Cosmopup thinks codelabs are awesome!!

c911c127bffdee57.jpeg

What's next?

Check out some of these codelabs...

Further reading & Videos

Reference docs