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¶
- Install gcoud CLI on your machine by following this guide.
- Initialize gcloud CLI by following this guide.
- Authorize cloud CLI by following this guide
Creating GCP credentials for Claudie¶
-
Create a GCP project:
-
Set the current project to claudie-project:
-
Attach billing account to your project:
-
Enable Compute Engine API and Cloud DNS API:
-
Create a service account:
-
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 } -
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-*orn1-highmem-*machine types with GPUs (note2-*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.
Spot VM Support¶
GCP Spot VMs are supported for worker nodepools. Set spot: true on any dynamic GCP nodepool to provision instances as Spot VMs, which offer 60–91% cost savings over on-demand pricing at the cost of potential reclamation with ~30 seconds of notice. Spot is only supported on worker (compute) nodepools and is rejected by the webhook on control-plane nodepools or unsupported providers.
Claudie automatically applies the label claudie.io/spot=true and the taint claudie.io/spot=true:NoSchedule to every node in the pool, so only pods with a matching toleration are scheduled there.
apiVersion: claudie.io/v1beta1
kind: InputManifest
metadata:
name: gcp-spot-example
labels:
app.kubernetes.io/part-of: claudie
spec:
providers:
- name: gcp-1
providerType: gcp
# GCP Spot VM support is available from claudie-config v0.11.4+
templates:
repository: "https://github.com/berops/claudie-config"
tag: v0.11.4
path: "templates/terraformer/gcp"
secretRef:
name: gcp-secret
namespace: secrets
nodePools:
dynamic:
- name: control-gcp
providerSpec:
name: gcp-1
region: us-central1
zone: us-central1-a
count: 1
serverType: e2-medium
image: ubuntu-2404-noble-amd64-v20251001
- name: spot-workers
providerSpec:
name: gcp-1
region: us-central1
zone: us-central1-a
count: 2
serverType: n1-standard-4
image: ubuntu-2404-noble-amd64-v20251001
storageDiskSize: 50
# Request GCP Spot VMs for this nodepool (worker pools only).
spot: true
kubernetes:
clusters:
- name: spot-example
version: v1.34.0
network: 172.16.3.0/24
pools:
control:
- control-gcp
compute:
- spot-workers
To schedule a workload onto spot nodes, add a matching toleration to the pod spec:
For a GPU inference pool that combines spot with scale-from-zero autoscaling, see the GCP Spot GPU inference 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.34.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.34.0
network: 192.168.2.0/24
pools:
control:
- control-gcp-1
- control-gcp-2
compute:
- compute-gcp-1
- compute-gcp-2