Skip to content

GCP

GCP provider requires you to input multiline credentials as well as specific GCP project ID gcpproject where to provision resources.

Compute and DNS example

apiVersion: v1
kind: Secret
metadata:
  name: gcp-secret
data:
  credentials: <base64-encoded-service-account-json>
  gcpproject: <base64-encoded-project-id>
type: Opaque

Create GCP credentials

Prerequisites

  1. Install gcoud CLI on your machine by following this guide.
  2. Initialize gcloud CLI by following this guide.
  3. Authorize cloud CLI by following this guide

Creating GCP credentials for Claudie

  1. Create a GCP project:

    gcloud projects create claudie-project
    

  2. Set the current project to claudie-project:

    gcloud config set project claudie-project
    

  3. Attach billing account to your project:

    gcloud alpha billing accounts projects link claudie-project (--account-id=<billing-account-id> | --billing-account=<billing-account-id>)
    

  4. Enable Compute Engine API and Cloud DNS API:

    {
      gcloud services enable compute.googleapis.com
      gcloud services enable dns.googleapis.com
    }
    

  5. Create a service account:

    gcloud iam service-accounts create claudie-sa
    

  6. Attach roles to the servcie account:

    {
      gcloud projects add-iam-policy-binding claudie-project --member=serviceAccount:[email protected] --role=roles/compute.admin
      gcloud projects add-iam-policy-binding claudie-project --member=serviceAccount:[email protected] --role=roles/dns.admin
    }
    

  7. Recover service account keys for claudie-sa:

    gcloud iam service-accounts keys create claudie-credentials.json --iam-account=[email protected]
    

DNS setup

If you wish to use GCP as your DNS provider where Claudie creates DNS records pointing to Claudie managed clusters, you will need to create a public DNS zone by following this guide.

GCP is not my domain registrar

If you haven't acquired a domain via GCP and wish to utilize GCP for hosting your zone, you can refer to this guide on GCP nameservers. However, if you prefer not to use the entire domain, an alternative option is to delegate a subdomain to GCP.

GPU Support

GCP requires explicit configuration to attach GPUs to compute instances. Unlike some other providers where GPU-enabled instance types automatically include GPUs, GCP uses a separate guest_accelerator mechanism that requires both GPU count and GPU type to be specified.

Configuration

To use GPUs with GCP nodepools, you must specify both nvidiaGpuCount and nvidiaGpuType in the machineSpec block:

nodePools:
  dynamic:
    - name: gpu-nodepool
      providerSpec:
        name: gcp-1
        region: us-central1
        zone: us-central1-a
      count: 2
      serverType: n1-standard-4
      image: ubuntu-2404-noble-amd64-v20251001
      machineSpec:
        nvidiaGpuCount: 1
        nvidiaGpuType: nvidia-tesla-t4

Available GPU Types

Common NVIDIA GPU accelerator types available on GCP:

GPU Type Description
nvidia-tesla-t4 NVIDIA Tesla T4 (cost-effective for inference)
nvidia-tesla-v100 NVIDIA Tesla V100 (high performance training)
nvidia-tesla-a100 NVIDIA A100 (latest generation)
nvidia-l4 NVIDIA L4 (successor to T4)
nvidia-tesla-p100 NVIDIA Tesla P100
nvidia-tesla-k80 NVIDIA Tesla K80 (legacy)

GPU Availability

GPU availability varies by zone. Check GCP GPU regions and zones for current availability in your desired region.

GPU Instance Limitations

  • GPU instances cannot be live migrated and will be terminated during maintenance events
  • Use n1-standard-* or n1-highmem-* machine types with GPUs (not e2-* types)
  • Some GPU types have minimum vCPU and memory requirements

For a complete GPU deployment example including the NVIDIA GPU Operator installation, see the GPU Example.

Input manifest examples

Single provider, multi region cluster example

Create a secret for Cloudflare and GCP providers

The secret for an GCP provider must include the following mandatory fields: gcpproject and credentials.

# The ./claudie-credentials.json file is the file created in #Creating GCP credentials for Claudie step 7.
kubectl create secret generic gcp-secret-1 --namespace=<your-namespace> --from-literal=gcpproject='<your-project-id>' --from-file=credentials=./claudie-credentials.json

apiVersion: claudie.io/v1beta1
kind: InputManifest
metadata:
  name: gcp-example-manifest
  labels:
    app.kubernetes.io/part-of: claudie
spec:
  providers:
    - name: gcp-1
      providerType: gcp
      secretRef:
        name: gcp-secret-1
        namespace: <your-namespace>

  nodePools:
    dynamic:
      - name: control-gcp
        providerSpec:
          # Name of the provider instance.
          name: gcp-1
          # Region of the nodepool.
          region: europe-west1
          # Zone is optional. If omitted, nodes are distributed across all zones in the region.
          zone: europe-west1-c
        count: 1
        # Machine type name.
        serverType: e2-medium
        # OS image name.
        image: ubuntu-2404-noble-amd64-v20251001

      - name: compute-1-gcp
        providerSpec:
          # Name of the provider instance.
          name: gcp-1
          # Region of the nodepool.
          region: europe-west3
          # Zone is optional. If omitted, nodes are distributed across all zones in the region.
          zone: europe-west3-a
        count: 2
        # Machine type name.
        serverType: e2-medium
        # OS image name.
        image: ubuntu-2404-noble-amd64-v20251001
        storageDiskSize: 50

      - name: compute-2-gcp
        providerSpec:
          # Name of the provider instance.
          name: gcp-1
          # Region of the nodepool.
          region: europe-west2
          # Zone is optional. If omitted, nodes are distributed across all zones in the region.
          zone: europe-west2-a
        count: 2
        # Machine type name.
        serverType: e2-medium
        # OS image name.
        image: ubuntu-2404-noble-amd64-v20251001
        storageDiskSize: 50

  kubernetes:
    clusters:
      - name: gcp-cluster
        version: v1.31.0
        network: 192.168.2.0/24
        pools:
          control:
            - control-gcp
          compute:
            - compute-1-gcp
            - compute-2-gcp

Multi provider, multi region clusters example

Create a secret for Cloudflare and GCP providers

The secret for an GCP provider must include the following mandatory fields: gcpproject and credentials.

# The ./claudie-credentials.json file is the file created in #Creating GCP credentials for Claudie step 7.
kubectl create secret generic gcp-secret-1 --namespace=<your-namespace> --from-literal=gcpproject='<your-project-id>' --from-file=credentials=./claudie-credentials.json
kubectl create secret generic gcp-secret-2 --namespace=<your-namespace> --from-literal=gcpproject='<your-project-id>' --from-file=credentials=./claudie-credentials-2.json

apiVersion: claudie.io/v1beta1
kind: InputManifest
metadata:
  name: gcp-example-manifest
  labels:
    app.kubernetes.io/part-of: claudie
spec:
  providers:
    - name: gcp-1
      providerType: gcp
      secretRef:
        name: gcp-secret-1
        namespace: <your-namespace>
    - name: gcp-2
      providerType: gcp
      secretRef:
        name: gcp-secret-2
        namespace: <your-namespace>

  nodePools:
    dynamic:
      - name: control-gcp-1
        providerSpec:
          # Name of the provider instance.
          name: gcp-1
          # Region of the nodepool.
          region: europe-west1
          # Zone of the nodepool.
          zone: europe-west1-c
        count: 1
        # Machine type name.
        serverType: e2-medium
        # OS image name.
        image: ubuntu-2404-noble-amd64-v20250313

      - name: control-gcp-2
        providerSpec:
          # Name of the provider instance.
          name: gcp-2
          # Region of the nodepool.
          region: europe-west1
          # Zone of the nodepool.
          zone: europe-west1-a
        count: 2
        # Machine type name.
        serverType: e2-medium
        # OS image name.
        image: ubuntu-2404-noble-amd64-v20250313

      - name: compute-gcp-1
        providerSpec:
          # Name of the provider instance.
          name: gcp-1
          # Region of the nodepool.
          region: europe-west3
          # Zone of the nodepool.
          zone: europe-west3-a
        count: 2
        # Machine type name.
        serverType: e2-medium
        # OS image name.
        image: ubuntu-2404-noble-amd64-v20250313
        storageDiskSize: 50

      - name: compute-gcp-2
        providerSpec:
          # Name of the provider instance.
          name: gcp-2
          # Region of the nodepool.
          region: europe-west1
          # Zone of the nodepool.
          zone: europe-west1-c
        count: 2
        # Machine type name.
        serverType: e2-medium
        # OS image name.
        image: ubuntu-2404-noble-amd64-v20250313
        storageDiskSize: 50

  kubernetes:
    clusters:
      - name: gcp-cluster
        version: v1.31.0
        network: 192.168.2.0/24
        pools:
          control:
            - control-gcp-1
            - control-gcp-2
          compute:
            - compute-gcp-1
            - compute-gcp-2