edit

Configuring IaaS Routing for GCP

This topic describes how to configure the Google Cloud Platform (GCP) load balancers to handle routing for Cloud Foundry Container Runtime (CFCR).

Before completing the procedures in this topic, you must have performed the steps in Paving Infrastructure on GCP. After finishing this topic, continue to Deploying BOSH for CFCR on GCP.

Note

CFCR was formerly known as Kubo, and many CFCR assets described in this topic still use the Kubo name.

Tip

Execute all of the commands in this topic from the Google Cloud Shell, not from your local machine.

(Optional) Step 1: Set Up Your Shell Environment

If you are still working in the same Google Cloud Shell session from the Paving Infrastructure on GCP topic, skip to Step 2: Configure Load Balancers.

If you have started a new Google Cloud Shell session, perform the following steps to set up your Google Cloud Shell environment:

  1. Log in to the GCP Console.
  2. From the left-hand navigation, click VPC network.
  3. Click Create VPC Network.

    Note

    If you plan to use Cloud Foundry to handle routing for CFCR, do not create a new network. Instead, deploy CFCR in the same network as Cloud Foundry.

  4. Set the prefix and zone from the Step 1: Set Up Your Shell Environment section of the Paving Infrastructure on GCP topic as environment variables. For example:

    $ export prefix=my-kubo $ export zone=us-west1-a $ export network=kubo-network $ export subnet_ip_prefix="10.0.1"

  5. SSH onto the bastion VM. Enter the following command:

    $ gcloud compute ssh "${prefix:-cfcr}-bosh-bastion" --zone ${zone}

  6. Set the kubo_env_name environment variable to kubo. Enter the following command:

    $ export kubo_env_name=kubo

Step 2: Configure Load Balancers

  1. Change into the GCP user guide directory of the kubo-deployment repo. Enter the following command:

    $ cd /share/kubo-deployment/docs/terraform/gcp/routing

  2. Export your state information as environment variables with the following commands:

    $ export state_dir=~/kubo-env/${kubo_env_name} $ export kubo_terraform_state=${state_dir}/terraform.tfstate

  3. Use Terraform to create the GCP resources for CFCR:

    $ terraform apply \ -var network=${network} \ -var projectid=${project_id} \ -var region=${region} \ -var prefix=${prefix:-cfcr} \ -var ip_cidr_range="${subnet_ip_prefix}.0/24" \ -state=${kubo_terraform_state}

  4. Set the master target pool from the outputted Terraform state file as an environment variable. Enter the following command:

    $ export master_target_pool=$(terraform output -state=${kubo_terraform_state} cfcr_master_target_pool)

  5. Set the Kubernetes master host from the outputted Terraform state file as an environment variable. Enter the following command:

    $ export kubernetes_master_host=$(terraform output -state=${kubo_terraform_state} master_lb_ip_address)

  6. Update the CFCR environment by running the set_iaas_routing script. Enter the following command:

    $ /usr/bin/set_iaas_routing "${state_dir}/director.yml"

    Tip

    You can also set the configuration manually by editing KUBO_ENV/director.yml.

After configuring routing, continue to the Deploying BOSH for CFCR on GCP topic.