> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tembo.io/llms.txt
> Use this file to discover all available pages before exploring further.

# GCP reference

> GKE, project and VPC requirements, the tembo-agent-host Terraform module, and the resources it creates on Google Cloud.

Details behind the GCP steps in [Prerequisites](https://docs.tembo.io/features/self-hosted/kubernetes/prerequisites.md) and [Install](https://docs.tembo.io/features/self-hosted/kubernetes/install.md). On GCP, Tembo runs on GKE and launches agent hosts as Compute Engine instances in your VPC.

Starting from an empty project? The module's [complete example](https://github.com/tembo/terraform-google-tembo-agent-host/tree/v0.2.0/examples/complete) creates a VPC with a subnetwork for hosts, Cloud NAT with dynamic port allocation, and a private GKE Autopilot cluster that hosts can reach.

## Projects and APIs

* **A project for agent hosts.** The host controller can create instances anywhere in the hosts' project, and change or delete only its own. We recommend a project of its own: set it as the module's `host_project_id`. Otherwise hosts run in the cluster's project.
* **APIs enabled** in those projects: `compute.googleapis.com`, `iam.googleapis.com`, `iamcredentials.googleapis.com` and `storage.googleapis.com`.

If `gcloud` reports `RESOURCE_EXHAUSTED` for Resource Manager reads against a shared consumer project, use a project you control for CLI quota. You need `serviceusage.services.use` on it:

```bash theme={null}
gcloud services enable cloudresourcemanager.googleapis.com cloudbilling.googleapis.com \
  --project=<quota-project>
gcloud config set billing/quota_project <quota-project>
```

## Organization policies

* `compute.disableNestedVirtualization` not enforced on the hosts' project: hosts run agents in VMs.
* `compute.requireShieldedVm` not enforced: the agent host image boots with legacy BIOS.
* If you restrict `compute.trustedImageProjects`, allow Tembo's image project, `projects/tembo-prod`.

## Control-plane access

The cluster must be VPC-native (Autopilot or Standard) with Workload Identity. Autopilot clusters always have it.

Administrators should use the cluster's DNS endpoint. An IP endpoint with an empty authorized-networks allowlist can leave `kubectl` hanging:

```bash theme={null}
gcloud container clusters update <cluster> --project=<project> --location=<location> \
  --enable-dns-access
gcloud container clusters get-credentials <cluster> --project=<project> --location=<location> \
  --dns-endpoint
kubectl get nodes
```

This needs `container.clusters.connect` and the `gke-gcloud-auth-plugin`.

Agent hosts read their configuration through the cluster's private IP endpoint. If it enforces master authorized networks, add the hosts' subnet:

```bash theme={null}
gcloud container clusters update <cluster> --project=<project> --location=<location> \
  --enable-master-authorized-networks \
  --master-authorized-networks=<existing-cidrs>,<hosts-subnet-cidr>
```

This flag **replaces** the allowlist: include every node, pod and administrator range that must keep access. Hosts in a different region than the cluster need the control plane's global access. Keep these settings in your Terraform if it manages the cluster.

## VPC and subnetwork

Agent hosts launch into a subnetwork you choose, in the cluster's VPC. Hosts have no external addresses, so they need:

* **Private Google Access,** for Cloud Storage and IAM.
* **Cloud NAT,** for egress to your Tembo URL, Tembo's API, model providers and code hosts such as GitHub.
* **Your own Postgres or Redis,** if you use them, must accept connections from the subnetwork. Hosts reach the bundled ones through internal load balancers.

The module reads the subnetwork and doesn't change it. It creates the firewall rule that lets the cluster's pods and nodes reach the hosts' manager on port 8743; for a Shared VPC subnetwork, in the network's host project.

### Cloud NAT

A host carries the egress of every session on it, and Cloud NAT's default of 64 ports per VM runs out with a couple of sessions. Turn on dynamic port allocation, with at least 1,024 ports per VM:

```bash theme={null}
gcloud compute routers nats update <nat> --router=<router> --region=<region> \
  --enable-dynamic-port-allocation --no-enable-endpoint-independent-mapping \
  --min-ports-per-vm=1024 --max-ports-per-vm=65536 \
  --enable-logging --log-filter=ERRORS_ONLY
```

## Quotas

Each host needs 32 vCPUs and 1,500 GB of local SSD, times the pool's maximum hosts (three by default). Free Trial billing accounts can't run a single host or request more quota.

* **N2 CPUs and local SSD** in the hosts' region.
* **Persistent Disk SSD** in the hosts' region: each host's 100 GB boot disk counts, as do GKE's node disks. New projects can have as little as 250 GB.
* **CPUs (all regions),** a project-wide limit that also counts the cluster's nodes. New projects can have as few as 12 vCPUs, not enough for one host.

Check limits and request increases in [Quotas & System Limits](https://console.cloud.google.com/iam-admin/quotas). If a request only says `Quota request denied`, check the console for the reason.

On a quota-limited project, start with one host. Add this to your `values.yaml`:

```yaml theme={null}
compute:
  hostPools:
    default:
      maxHosts: 1
```

Leave room for your cluster's nodes and node upgrades, and for a replacement host while hosts are replaced. For example, a 48-vCPU project fits one host plus a Standard zonal cluster capped at three `e2-standard-4` nodes. Autopilot scales its nodes automatically; use Standard with a capped node pool when you need a predictable CPU budget.

## Permissions to apply

Apply the module as the projects' Owner, or with these roles, plus `roles/container.clusterViewer`. Editor isn't enough: it can't create the controller's custom roles or set IAM on the subnetwork.

| Project | Roles |
| - | - |
| The cluster's project | `roles/iam.serviceAccountAdmin`, `roles/storage.admin` |
| The hosts' project | `roles/iam.serviceAccountAdmin`, `roles/iam.roleAdmin`, `roles/resourcemanager.projectIamAdmin` |
| The subnetwork's project | `roles/compute.networkAdmin`, `roles/compute.securityAdmin` |

## The Terraform module

The [`tembo-agent-host` module for Google Cloud](https://github.com/tembo/terraform-google-tembo-agent-host) needs Google provider 6.0 or later. It creates:

* **The host controller's service account**, bound to the chart's service account with Workload Identity. It can change and delete only instances and disks named with your install's prefix, launch them only into your subnetwork, and attach only the hosts' service account.
* **The agent hosts' service account**, with access to the install's bucket.
* **The firewall rule** for the hosts' manager.
* **A GCS bucket** for project images, session snapshots and file uploads, and the control plane's service account to use it. To use a bucket you have, set `object_storage_bucket_name`.

The service accounts trust only the chart's service accounts in `kubernetes_namespace`, for `release_name`. See the [module's README](https://github.com/tembo/terraform-google-tembo-agent-host) for the other options, such as `machine_types`.

Its `helm_values` output configures the chart with:

* GKE's Ingress (`ingress.gcp`).
* The host controller, with its service account, the hosts' project and your install's instance name prefix.
* A host class named `default`, with your subnetwork, the hosts' service account, `n2-custom-32-65536` with four local SSDs, and Tembo's `stable` agent host image.
* A pool named `default`, of one to three hosts.
* Object storage, with the bucket and the control plane's service account.

The [Install](https://docs.tembo.io/features/self-hosted/kubernetes/install.md) example adds `loadBalancerSourceRanges` for the bundled Postgres and Redis, from the module's `host_subnetwork_cidr` output, so only agent hosts can reach them.

***

## Need Help?

If you run into any issues, contact [support@tembo.io](mailto:support@tembo.io).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.