GoogleCloudPlatform/cluster-toolkit
Sobre
Cluster Toolkit is an open-source software offered by Google Cloud which makes it easy for customers to deploy AI/ML and HPC environments on Google Cloud.
Aprendizado e educaçãoO que você pode fazer
- Automatic Cross-Module Wiring (use:): Connecting a VPC, Private Service Access, Managed Lustre / Filestore / GCS FUSE (network_storage), and multiple Slurm partitions or GKE node pools takes a single use: [vpc, homefs] line instead of hundreds of lines of manual Terraform variable/output plumbing.
- Staged Deployment Groups (deployment_groups): Automatically sequences multi-stage infrastructure (cluster-env → image → cluster) so Packer image builds and Kubernetes/Helm providers never fail during terraform plan before the cluster exists.
- Fast Pre-Deploy Validation: Validates YAML syntax, module inputs, enabled GCP APIs, quotas, zones, and reservations in seconds via ./gcluster expand / ./gcluster create before Terraform runs.
Crescimento medido de estrelas
- em 24 h
- 0
- em 7 dias
- 0
- em 15 dias
- 0
- em 1 mês
- Coletando histórico
Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.
README.md
OriginalGoogle Cluster Toolkit (formerly HPC Toolkit)
Description
Cluster Toolkit is an open-source software provided by Google Cloud that makes it easy to deploy AI/ML and high performance computing (HPC) environments following Google Cloud best practices.
Cluster Toolkit is highly customizable and extensible, addressing the deployment needs of a broad range of workloads, such as compute, networking, and storage, in a repeatable manner.
Detailed documentation and main components
Cluster Toolkit comes with a suite of tutorials, examples, and full documentation for modules designed for AI/ML and HPC use cases.
The main components of Cluster Toolkit include:
- Cluster blueprints: YAML files that define the cluster's infrastructure and configuration.
- Modules: Reusable building blocks (Terraform or Packer) used to compose a blueprint.
- gcluster engine: The command-line tool that processes blueprints to create a deployment folder.
- Deployment folder: A self-contained folder containing the Terraform or Packer code needed to provision the environment.
For more information, see Google Cluster Toolkit overview.
Why use Cluster Toolkit (gcluster) instead of raw gcloud or raw Terraform?
- Turnkey Multi-NIC GPUDirect RDMA for AI Hypercomputer (A3 Ultra, A4, A4X): GPU clusters with 8 NICs require secondary RoCE/MRDMA VPCs,
GKENetworkParamSetobjects, NCCLgibinstallers, and Kueue Topology-Aware Scheduling (TAS) or Slurm topology plugins—none of which a singlegcloud container clusters createorgcloud compute instances createcommand configures. - Automatic Cross-Module Wiring (
use:): Connecting a VPC, Private Service Access, Managed Lustre / Filestore / GCS FUSE (network_storage), and multiple Slurm partitions or GKE node pools takes a singleuse: [vpc, homefs]line instead of hundreds of lines of manual Terraform variable/output plumbing. - Staged Deployment Groups (
deployment_groups): Automatically sequences multi-stage infrastructure (cluster-env→image→cluster) so Packer image builds and Kubernetes/Helm providers never fail duringterraform planbefore the cluster exists. - Fast Pre-Deploy Validation: Validates YAML syntax, module inputs, enabled GCP APIs, quotas, zones, and reservations in seconds via
./gcluster expand/./gcluster createbefore Terraform runs.
AI Hypercomputer
Cluster Toolkit is an integral part of Google Cloud AI Hypercomputer. For more information about GKE and Slurm deployments in AI Hypercomputer, see Create an AI-optimized GKE cluster with default configuration and Create a self-managed Slurm cluster for AI workloads.
Quickstart
To get started with Cluster Toolkit deployments, you can follow one of the following quickstart guides:
- Deploy an HPC cluster with Slurm.
- Create a self-managed Slurm cluster with an A4 VM.
- Create a Cloud RDMA-enabled HPC Slurm cluster with H4D instances.
Install Cluster Toolkit
To create a cluster using Cluster Toolkit, you can use either Cloud Shell, or a workstation that is running Linux or macOS.
Cloud Shell is an interactive development and operations environment that is accessible from your web browser. If you use Cloud Shell, the following dependencies are already pre-installed and you don't need to manually install dependencies.
If you want to work from a Linux or macOS client or workstation, you must follow the steps in Install dependencies before you continue.
You can use two different methods to install Cluster Toolkit:
Using the pre-built bundle (recommended)
For the easiest setup, download the appropriate bundle for your operating system and architecture from the Releases page. These bundles include the pre-compiled gcluster binary, the examples folder, and the community/examples folder.
Bundle compatibility matrix
The pre-built bundles are compiled for Linux and macOS execution environments and support the deployment of the following cluster operating systems.
| Platform | Support Status | Notes |
|---|---|---|
| Linux (amd64 / arm64) | ✅ | Pre-compiled on Debian Bullseye. |
| Google Cloud Shell | ✅ | Native support via the Linux amd64 binary. |
| macOS (amd64 / arm64) | ✅ | Native support via the Mac binary. |
| Windows | ⚠️ | Pre-built bundle not provided; please Build from source (go build -o gcluster.exe .). WSL2 is recommended for blueprints using shell-based local-exec provisioners. |
Download and extract the latest bundle from Releases:
# Set your OS (linux or mac) and architecture (amd64 or arm64) OS="linux" ARCH="amd64" # Latest release (to pin a specific version, replace "latest/download" with "download/vX.Y.Z") mkdir -p cluster-toolkit && curl -L https://github.com/GoogleCloudPlatform/cluster-toolkit/releases/latest/download/gcluster_bundle_${OS}_${ARCH}.tgz | tar -xz -C cluster-toolkit && cd cluster-toolkitVerify the installation:
./gcluster --version ./gcluster --help
Building from source
If you prefer to build the gcluster binary from source (requires Go 1.26+, Terraform 1.12.2+, and Packer 1.15.3+), run:
git clone https://github.com/GoogleCloudPlatform/cluster-toolkit.git
cd cluster-toolkit
make
./gcluster --version
./gcluster --help
[!NOTE] You must install dependencies (such as Go and Terraform) before building, otherwise the
makecommand fails. On Windows (PowerShell / Command Prompt), build directly usinggo build -o gcluster.exe ..
Prerequisites
Before deploying your first cluster, ensure the following are configured in your Google Cloud project.
Enable APIs
Several APIs must be enabled to deploy your cluster. While Terraform identifies missing APIs during terraform apply, enabling them upfront saves time. Required APIs typically include:
- Compute Engine API (
compute.googleapis.com) - Managed Lustre API (
lustre.googleapis.com) and Service Networking API (servicenetworking.googleapis.com) for AI Hypercomputer GPU/TPU blueprints - Filestore API (
file.googleapis.com) - Cloud Storage API (
storage.googleapis.com) - Service Usage API (
serviceusage.googleapis.com)
For more information, see Set up Cluster Toolkit.
Quotas
HPC and AI workloads often require significant resources. You might need to request additional quota to deploy your cluster. For more information, see Request additional quotas.
GCP credentials
Terraform can provide credentials for authenticating to Google Cloud in several ways. We recommend using gcloud on your workstation or using service accounts attached to cloud environments.
[!WARNING] We do not recommend downloading or using service account JSON keys. These keys are long-lived credentials that pose a significant security risk if leaked. Instead, use short-lived credentials via Application Default Credentials (ADC).
On your local terminal, Cloud Workstations, or Cloud Shell, generate Application Default Credentials (ADC) associated with your Google Cloud account:
gcloud auth application-default login
Follow the prompts in your browser to authenticate. You are provided a token to copy and paste back into your terminal to complete the process. Once finished, Terraform automatically uses these "Application Default Credentials."
If you receive a quota project error, then set the quota project to your current project ID:
gcloud auth application-default set-quota-project ${PROJECT_ID}
Telemetry and privacy notice
To help improve Cluster Toolkit, feature usage statistics are collected and sent to Google. You can opt-out at any time by executing the following command:
./gcluster telemetry off
Cluster Toolkit telemetry overall is handled in accordance with the Google Privacy Policy. When you use Cluster Toolkit to interact with or utilize GCP Services, your information is handled in accordance with the Google Cloud Privacy Notice.
Cluster creation and management
After installing gcluster, you can deploy, manage, and destroy infrastructure using cluster blueprints:
Deploy cluster in a single step (expands the blueprint and provisions infrastructure with Terraform, optionally passing user overrides via
-d deployment.yaml):./gcluster deploy examples/hpc-slurm.yaml --vars project_id=<PROJECT_ID>Or validate and create the deployment folder first without provisioning cloud resources:
./gcluster expand examples/hpc-slurm.yaml --vars project_id=<PROJECT_ID> -o /dev/null ./gcluster create examples/hpc-slurm.yaml --vars project_id=<PROJECT_ID> ./gcluster deploy hpc-slurmDestroy cluster: Clean up provisioned resources:
./gcluster destroy hpc-slurm
CLI Commands Overview
| Command | Description |
|---|---|
./gcluster explain [MODULE | BLUEPRINT | SPECS...] [-f text|yaml|json] |
List available blueprints/modules, inspect required APIs, variables, and use: wiring, or match specs to the closest blueprint. |
./gcluster deploy (<DEPLOYMENT_DIR> | <BLUEPRINT_FILE>) [-d <DEPLOYMENT_FILE>] |
Create (if given a blueprint) and deploy all resources in a deployment directory. |
./gcluster create <BLUEPRINT_FILE> [-d <DEPLOYMENT_FILE>] |
Generate a self-contained Terraform/Packer deployment directory from a blueprint. |
./gcluster expand <BLUEPRINT_FILE> [-d <DEPLOYMENT_FILE>] |
Expand and validate a blueprint without writing the deployment directory. |
./gcluster destroy <DEPLOYMENT_DIR> |
Destroy all cloud resources in a deployment directory. |
./gcluster export-outputs <DEPLOYMENT_GROUP_DIR> |
Export Terraform outputs from a deployment group for cross-group consumption. |
./gcluster import-inputs <DEPLOYMENT_GROUP_DIR> |
Import output values from prior deployment groups as input .tfvars. |
./gcluster cluster <list|describe|info|volume> |
Discover, list, and inspect deployed target clusters and storage volumes. |
./gcluster job <submit|list|logs|cancel|config|inspect|gke-template-extract> |
Submit, monitor, inspect, and manage workloads on GKE and Kubernetes clusters. |
./gcluster telemetry <on|off> |
Enable or disable anonymous usage telemetry. |
./gcluster completion <bash|zsh|fish|powershell> |
Generate shell autocompletion scripts. |
For complete flag documentation, see cmd/README.md.
Automatic Dependency Management
When running commands like deploy or destroy in non-interactive environments (such as CI/CD pipelines), the toolkit can automatically download missing HashiCorp dependencies (Terraform and Packer) by passing the --download-dependencies flag.
--download-dependencies: Automatically download missing dependencies without prompting.--download-dependencies=false: Fail immediately if any required dependencies are missing.
In interactive terminals, this flag is optional; the toolkit will ask for confirmation before downloading missing dependencies.
For detailed guides, blueprint syntax, and configuration options, see the Google Cloud documentation site.
Job submission (gcluster job submit)
The gcluster job submit command provides a unified interface to submit batch and distributed containerized workloads (JobSets, or standalone batch/v1 Indexed Jobs when JobSet is absent) to your GKE or Kubernetes clusters.
Prerequisites for job submission
Ensure your environment is set up before submitting jobs:
- A GKE cluster (with
kubectl,gke-gcloud-auth-plugin, andgcloud auth login) or a generic Kubernetes cluster configured inKUBECONFIG(requires onlykubectl; JobSet and Kueue are optional). - For on-the-fly builds (
--build-context), setexport GCLUSTER_IMAGE_REPO=<repository-name>(Artifact Registry repository name, or<registry-host>[/<repository>]for custom OCI registries).
Configure default settings
To reduce boilerplate in job submit commands, you can set default configuration values for project, location, and cluster.
You can open your default system text editor interactively:
./gcluster job config set
Or you can set values individually:
./gcluster job config set project my-project
./gcluster job config set cluster my-cluster
./gcluster job config set location us-central1-a
Check the active configuration using:
./gcluster job config show
Submit a JobSet
There are two ways to submit a JobSet with the gcluster job submit command:
- Submit with a pre-built image: Submit a job using an existing container image from an image registry.
- Submit with on-the-fly image building: Package local application code into a container image and push it automatically.
Submit with a pre-built image
To submit with a pre-built image, run ./gcluster job submit with the following properties in your shell:
./gcluster job submit \
--project <PROJECT_ID> \
--cluster <CLUSTER_NAME> \
--location <REGION_OR_ZONE> \
--name my-job \
--image us-docker.pkg.dev/samples/gke/hello-app:1.0 \
--command "echo Hello from Cluster Toolkit" \
--compute-type n2-standard-32
Submit with on-the-fly image building
To submit with on-the-fly image building, run ./gcluster job submit with the following properties in your shell:
./gcluster job submit \
--project <PROJECT_ID> \
--cluster <CLUSTER_NAME> \
--location <REGION_OR_ZONE> \
--name my-python-job \
--base-image python:3.11-slim \
--build-context ./app_dir \
--command "python main.py" \
--compute-type n2-standard-32
Manage jobs
You can manage submitted jobs directly using the gcluster job commands:
- List jobs: Check workload status across the cluster.
- View job logs: View container stdout and stderr logs.
- Cancel a job: Clean up a running workload.
List jobs
Check workload status across the cluster:
./gcluster job list
View job logs
View container stdout and stderr logs:
./gcluster job logs my-job
Cancel a job
Clean up a running workload:
./gcluster job cancel my-job
For complete step-by-step tutorials, advanced multi-slice topologies, storage mounts, and Kueue queue management, refer to the full Gcluster Job Submission Guide.
Advanced GKE infrastructure orchestration
The gcluster job submit command integrates natively with advanced Google Kubernetes Engine (GKE) hardware and scheduling capabilities:
- Dynamic TPU slicing: Reconfigure and pack TPU v7x (and future TPU generation) nodes into logical slices dynamically (supporting both superslicing and subslicing) by using the
--topologyflag and Kueue Topology-Aware Scheduling. - Pathways distributed AI orchestration: Compile and deploy multi-slice Pathways training jobs (Resource Manager, Proxy, Workers, and optional headless mode) by using the
--pathwaysand--pathways-gcs-locationflags. - GKE node auto-provisioning (NAP): Automatically scale and provision compute nodes dynamically by using the
--gke-nap-provisioning(spot,reservation,on-demand) and--gke-nap-reservationflags.
For cluster blueprint Terraform deployment instructions and comprehensive workload orchestration guidelines, see the guide to advanced GKE infrastructure features and the gcluster job submission guide.
VM image support
Cluster Toolkit provides specialized modules for Slurm images, and support for standard OS images.
Slurm images
Cluster Toolkit provides specialized modules for Slurm.
[!NOTE] Slurm Terraform modules must be used with images specifically built for the versioned release of the module. To learn more about pre-built and custom Slurm images, see Slurm VM Images.
Standard images
The toolkit also supports standard OS images for general-purpose modules:
- Rocky Linux 9
- Ubuntu 24.04 LTS
For more details, see VM image support.
Blueprint validation
A cluster blueprint is the core configuration file (YAML) for your deployment. Cluster Toolkit includes validator functions that perform basic tests on the blueprint to ensure variables are valid and resources can be provisioned. See Blueprint validation for more details.
Documentation guides (docs/)
- GPU & AI Hypercomputer: GPU Support
- GKE Orchestration & Workloads: Gcluster Job Submission Guide, Advanced GKE Infrastructure Features, GKE Cluster Management, Migrating from XPK to Cluster Toolkit
- Slurm on GCP: Slurm GCP Support, Slurm Advanced Features, Slurm Image Upgrade, Slurm Topology, Slurm DWS Flex-Start, Slurm DWS Calendar Mode, Slurm Native Auth Migration, CHS Slurm, Hybrid Slurm Cluster, Slurm Troubleshooting
- Storage, Images & Batch: Network Storage, VM Images, Custom Image Building, Cloud Batch
- Validation & Module Authoring: Blueprint Validation, Module Guidelines
- Cluster Director: Export deployments to Cluster Director
- LLM & AI Assistant Indexes:
llms.txt(concise index) andllms-full.txt(complete blueprint and module reference)
Billing reports
To track the costs of your deployment, use the Cloud Billing Reports page. You need a role with the billing.accounts.getSpendingInformation permission.
- In the Google Cloud Console, go to Billing.
- Select Reports.
- In the Filters pane on the right, filter by label using the key
ghpc_deploymentorghpc_blueprintand specify your deployment name.
Troubleshooting
Authentication
Ensure you have properly set up Google Cloud credentials.
Slurm clusters
Terraform deployment
Common deployment failures:
- Project Access: Ensure your account has the necessary roles in the IAM section of the console.
- Filestore resource limit: If you see "System limit for internal resources has been reached," see the Filestore troubleshooting guide for the solution.
Development
[!NOTE] While macOS is supported for building and running the toolkit, it is not recommended for core development due to GNU-specific shell scripts. If developing on macOS, install GNU tools (e.g.,
coreutils,findutils) via Homebrew or Conda to avoid script failures.
Setup
Install the following tools to ensure your changes pass validation:
- pre-commit
- TFLint (requires version compatible with
.tflint.hcl)
Additional development dependencies can be installed with a single command:
make install-dev-deps
pre-commit install
Contributing
Please refer to CONTRIBUTING.md.
Explore projetos relacionados
Carregando…