Skip to main content

GCP Deployment Guide (GKE)

Complete guide for deploying StateSet Sandbox on Google Kubernetes Engine (GKE).

Prerequisites

  • gcloud CLI configured with appropriate permissions
  • kubectl installed
  • Helm 3.x installed
  • Domain name for API endpoint
  • GCP Project with billing enabled

Quick Start (Kustomize Overlay)

Use the GCP-specific overlay to apply the correct ingress/controller defaults:
stateset-sandbox is the @stateset/sandbox-cli binary. It also installs a stateset alias, but that name collides with @stateset/cli, whose stateset has no deploy command, so use the long name. For smoke checks, export credentials before running deploy:
Before applying the overlay, provision the required controller auth secret:

Architecture Overview

Step 1: Set Up GCP Project

Step 2: Create VPC Network

Step 3: Create GKE Cluster

Option A: GKE Standard with gVisor

Option B: GKE Autopilot

Note: GKE Autopilot supports gVisor via RuntimeClass with sandbox isolation.

Step 4: Create Cloud SQL (PostgreSQL)

Step 5: Create Memorystore (Redis)

Step 6: Create Cloud Storage Bucket

Step 7: Set Up Secret Manager

Step 8: Configure Workload Identity

Step 9: Deploy StateSet Sandbox

Create Namespace

Configure Service Account for Workload Identity

Create ConfigMap

Create External Secrets

Apply Custom Resource Definitions

CRDs must be applied before the main deployment so the API server recognises StateSet resource types:

Deploy Components

Create gVisor RuntimeClass

CRD Usage Examples

With the CRDs installed you can manage sandboxes and warm pools declaratively:

Step 10: Configure Load Balancer & SSL

Managed SSL Certificate

Ingress with GCE Load Balancer

Cloud Armor Security Policy (Optional)

Step 11: Set Up Monitoring

Cloud Monitoring

GKE automatically sends metrics to Cloud Monitoring. Enable additional features:

Custom Dashboards

Create monitoring dashboard in Cloud Console or via API:

Alerting Policies

Cloud Logging

Query logs:

Step 12: Configure Autoscaling

Cluster Autoscaler

Already enabled when creating node pool with --enable-autoscaling. Configure behavior:

Horizontal Pod Autoscaler

Security Hardening

Binary Authorization

VPC Service Controls (Enterprise)

Cloud KMS for Encryption

Confidential Computing (Optional)

For maximum isolation with Confidential VMs:

Cost Optimization

Committed Use Discounts

Purchase committed use discounts for predictable controller workloads:

Preemptible VMs for Sandboxes

Estimated Monthly Costs

Troubleshooting

Common Issues

Cloud SQL connection issues
gVisor pods not scheduling
Certificate not provisioning

Useful Commands

Support Resources

The GCP cluster above runs sandboxed, untrusted code. Do not reuse an existing GKE cluster that also runs your own services: the isolation story in the security guide assumes a dedicated node pool, and a shared one gives a sandboxed process neighbours worth attacking.

Next steps

Security guide

Read before this cluster takes untrusted code — network policy is what contains it.

Operations

Health probes, metrics and runbooks for the cluster you just built.

Production guide

Capacity, warm pools and the settings that decide cost.

Other providers

The same deployment on the other two clouds.
Last modified on August 31, 2026