KOP GKE Clusters - GCP Configuration - Rafay Product Documentation

GCP Configuration

GCP IAM

To create and manage GKE clusters, complete the following configuration in GCP console


Step 1: GCP Project

Important
Skip this step if you would like to use an "existing" GCP project


Step 2: IAM Policy

Create Service Account

Add Roles to SAs

Add the below roles to the created Service Account

Click Continue

Grant User Access

Optionally, add one or more users to this service account and click Done

On successful creation, you can view the service account listed in the table as shown below


Step 3: JSON Credential

Once the Service Account is created,

By default, JSON key type is selected

On successful creation, the json file will be downloaded automatically. We will use this json file to create a Cloud Credential in Controller for GKE lifecycle management.


Step 4: Enable APIs

Enable the following APIs on your Google Cloud Platform to allow the controller to interact with GCP programmatically using GCP's APIs.

In the GCP Console,

Below is an example showing what this looks like for the Compute Engine API


Cross Project Service Accounts

Users can now leverage a centralized IAM service account from one Google Cloud project to provision GKE clusters in another project, streamlining service account management across the organization.

To enable cross-project service account usage, follow the steps below. Assume Project demos-12345 is the project from which a service account is to be used to create a cluster in Project dev-12345

Step 1: Enabling Cross-Project Service Account Usage in GCP

Step 2: Configure Service Account

gcloud projects describe dev-12345 --format="value(projectNumber)"
1035233614964
gcloud iam service-accounts add-iam-policy-binding \
     sa-cross-prj@demos-12345.iam.gserviceaccount.com  \
      --member=serviceAccount:service-1035233614964@compute-system.iam.gserviceaccount.com \
      --role=roles/iam.serviceAccountTokenCreator --project demos-12345
gcloud iam service-accounts add-iam-policy-binding \
     sa-cross-prj@demos-12345.iam.gserviceaccount.com  \
      --member=serviceAccount:service-1035233614964@container-engine-robot.iam.gserviceaccount.com \
      --role=roles/iam.serviceAccountUser --project demos-12345
gcloud iam service-accounts add-iam-policy-binding \
     sa-cross-prj@demos-12345.iam.gserviceaccount.com  \
      --member=serviceAccount:1035233614964@cloudservices.gserviceaccount.com \
      --role=roles/iam.serviceAccountUser --project demos-12345

Step 3: Launch the GKE cluster in Controller

Launch the cluster in Project dev-12345 using the controller, but utilize the cloud credential with the service account sa-cross-prj@demos-12345.iam.gserviceaccount.com from project demos-12345.

After successful provisioning, the cloud credential GCP Project and cluster GCP Project differ in the cluster Configuration.


Reservation Affinity

Users can reserve Compute Engine instances in a specific zone to ensure that resources are available for their workloads when needed. Reservation ensures Compute Engine resources are readily available by securing capacity for zonal resources. With capacity reservation, VMs start in less than 120 seconds, offering quick access to resources. Each reservation guarantees capacity for one or more VMs with the same properties, and reserved resources are available immediately upon creation and persist until deletion. For more information, visit this page

Create Reservation

To create a reservation, perform the below steps in the Google Cloud Console.

Once the reservation is created, view it as depicted below:

NOTE: Upon successful creation of a reservation, the user can only edit the Number of VM instances and not any other details.

Users can utilize these VM reservations when adding the GKE Clusters Node Pool configuration via the controller. Also, these reservations can be used by multiple clusters until the capacity limit is reached.