This document explains how Cluster Toolkit provisions
Google Kubernetes Engine (GKE) clusters and generates Kubernetes JobSet manifests
for Pathways workloads on Cloud TPU node pools. It covers cluster
configuration, execution modes, head node sizing, runtime behavior, and
colocated Python sidecar image resolution.
For more information about Pathways architecture, the single-controller programming model, and core Pathways components, see Introduction to Pathways on Cloud. For step-by-step instructions to deploy and submit Pathways workloads, see Run workloads with Pathways.
How Cluster Toolkit orchestrates Pathways
Cluster Toolkit orchestrates Pathways workloads across two
stages: cluster provisioning in your
blueprint and manifest
generation at job submission time with the gcluster
CLI.
Blueprint configuration
When you set the enable_pathways_for_tpus variable to true in your
blueprint, Cluster Toolkit configures the
gke-cluster module and the
kubectl-apply module with the
following settings:
- Dedicated CPU node pool for the coordinator: the
gke-clustermodule provisions an autoscaled CPU node pool of 0 to 100n4-standard-64nodes namedcpu-npfor the Pathways coordinator:- By default, the
gcluster job submitcommand schedules the Pathways head Pod on thecpu-npnode pool. - To target a custom CPU node pool, pass the
--pathways-head-npflag when you submit a job.
- By default, the
Kueue configuration for Pathways: the
kubectl-applymodule configures Kueue for Pathways workloads:- Binds the
pathways-flavorResourceFlavorcustom resource to thecpu-npnode pool. - Groups the
google.com/tpu,cpu, andmemoryresources into a singleClusterQueueresource group so worker Pods don't trigger flavor conflicts. - Sets the
waitForPodsReady.recoveryTimeoutfield to a value of0son Kueue version0.19.0and later so elastic slices aren't evicted while waiting for replacement nodes.
To customize the Kueue template, quota variables, or
waitForPodsReadytimeouts, configure thekueue.config_pathfield, thekueue.config_template_varsfield, or thekueue.wait_for_pods_readyblock in thekubectl-applymodule.- Binds the
Generated JobSet manifest
When you submit a workload with the gcluster job submit --pathways
flag, the
gcluster CLI generates a multi-role Kubernetes JobSet manifest that
coordinates three functional roles:
- Resource manager: the
pathways-rmcontainer runs in thepathways-headPod to manage Cloud TPU slice allocations, topology assignments, and elastic worker recovery across slices. - Proxy server: the
pathways-proxycontainer runs an Interim Framework Runtime (IFRT) proxy server in thepathways-headPod to compile and dispatch client JAX programs across the allocated Cloud TPU slices. - Workers and optional sidecars: the
pathways-workercontainer runs in each Cloud TPU worker Pod to execute compiled computations, alongside an optionalcolocated-python-sidecarcontainer when you enable colocated Python.
For more information about how these containers interact on GKE, see Pathways components on GKE.
Execution modes
The gcluster job submit command supports multiple Pathways execution modes so
that you can choose between self-contained batch jobs, interactive development,
and shared persistent infrastructure. The following table compares the
available execution modes:
| Execution mode | Primary flags | Head Pod containers | When to use |
|---|---|---|---|
| Standard batch | --pathways, --image or --base-image, and --command |
pathways-rm, pathways-proxy, and workload-container |
Run self-contained, containerized JAX training or evaluation jobs inside the cluster. |
| Headless interactive | --pathways and --pathways-headless |
pathways-rm and pathways-proxy |
Deploy persistent Pathways infrastructure and connect interactively from a workstation or notebook over port forwarding. |
| Shared Pathways Service (SPS) instance | --pathways and --pathways-deploy-sps |
pathways-rm |
Deploy a persistent, shared Pathways resource manager and Cloud TPU worker pool that multiple client workloads can target. |
| SPS client workload | --pathways and --pathways-run-sps-workload |
pathways-proxy, plus workload-container for in-cluster jobs |
Submit a JAX workload against an existing SPS instance without provisioning dedicated Cloud TPU slices for that job. |
You can combine standard batch, headless interactive, or SPS deployments with
an optional colocated Python sidecar by passing the
--pathways-colocated-python-sidecar-image flag. A colocated Python sidecar is
an optional container that runs alongside the pathways-worker container in
each Cloud TPU worker Pod. It lets JAX @colocated_python functions
run host-bound Python work, such as data loading and checkpointing, directly on
worker VMs instead of routing that work through the single controller. For more
information, see How colocated Python works with
Pathways.
Head node resources and sizing
Each pathways-head Pod isolates itself from other JobSet Pods on the same
CPU node by setting the alpha.jobset.sigs.k8s.io/exclusive-topology:
kubernetes.io/hostname annotation, and runs with the Burstable quality of
service class. If non-JobSet workloads can schedule on the head node pool, then
dedicate or taint that node pool to prevent co-location.
Head containers set baseline requests fields, such as 12 vCPUs and
48 GiB total in standard batch mode, and omit limits fields so that they
can burst into the node's remaining allocatable CPU and memory. The following
table lists the baseline requests for each head container:
| Container | CPU request | Memory request | Execution modes |
|---|---|---|---|
pathways-rm |
2 |
8Gi |
Standard batch, headless interactive, and SPS instances deployed with the --pathways-deploy-sps flag |
pathways-proxy |
8 |
32Gi |
Standard batch, headless interactive, and SPS client workloads submitted with the --pathways-run-sps-workload flag |
workload-container |
2 |
8Gi |
Standard batch and in-cluster SPS client workloads submitted with the --pathways-run-sps-workload flag |
For workloads with heavy host-side memory usage, such as staging large model weights, consider the following:
- Make sure that the Pathways head node pool has more memory per node than the
combined peak usage of the
workload-container,pathways-proxy, andpathways-rmcontainers, with enough nodes for concurrent head Pods. - If the default
n4-standard-64machine type on thecpu-npnode pool is too small, then add a larger custom CPU node pool with a matching KueueClusterQueueResourceFlavorresource and target it with the--pathways-head-npflag.- For example, use the
n4-highmem-80machine type with 640 GiB of memory. - When confidential nodes are enabled, use the
n2d-highmem-96machine type with 768 GiB of memory or thec3-highmem-88machine type with 704 GiB of memory.
- For example, use the
Runtime behavior
Pathways jobs submitted with the gcluster CLI follow specific lifecycle,
termination, and environment variable rules. For exact flag defaults, bounds,
and syntax, see the gcluster job submit flag
reference.
- Completion and worker restarts: worker Pods run with the
restartPolicy: OnFailuresetting so that worker containers restart in place after a client disconnects instead of failing the workerJobresource, allowing successful runs to complete through theJobSetsuccessPolicyfield. The--pathways-max-slice-restartsflag controls per-index worker Pod replacements before a worker failure triggers aJobSetrestart under the--restartsflag limit. - Termination grace periods: for Pathways jobs, the
--grace-periodflag applies only to worker Pods while thepathways-headPod keeps the Kubernetes default grace period, so head-side cleanup and final checkpoints must finish within that window. When a colocated Python sidecar is enabled, worker Pods take the full grace period to stop, which delaysJobSetrestarts and holds Cloud TPU slice nodes until termination completes. - Environment variable overrides: the
gclusterCLI sets default environment variables across Pathways containers, including proxy routing and pipe timeout defaults. Any values passed through the--env,--pathways-proxy-env,--pathways-server-env, or--pathways-worker-envflags replace matching defaults in the corresponding container, including verbose logging defaults from the--verboseflag.
Colocated Python image resolution
When you enable a colocated Python sidecar with the
--pathways-colocated-python-sidecar-image flag, use the same Pathways release
for the colocated-python-sidecar, pathways-rm, pathways-worker, and
pathways-proxy containers. For prebuilt image URIs, supported release tags,
and custom sidecar builds, see Prebuilt images and
tags
and Build a custom sidecar
image.
The gcluster CLI resolves server and proxy images using the following rules:
- Public sidecar image: when you pass the public
us-docker.pkg.dev/cloud-tpu-v2-images/cloud-pathways/colocated_python_sidecarimage with a release tag, thegclusterCLI automatically selects the matchingcloud-pathwaysserver and proxy images for any flag you omit. - Custom or digest-only sidecar image: because the
gclusterCLI can't infer a release tag from a custom image or a digest-only reference, pass matchingcloud-pathways--pathways-server-imageand--pathways-proxy-server-imageflags explicitly. When you deploy an SPS instance with the--pathways-deploy-spsflag, pass only the--pathways-server-imageflag, because an SPS instance doesn't run a proxy container. - Explicit flags take precedence: any
--pathways-server-image,--pathways-proxy-server-image, or--pathways-worker-imageflag you pass is preserved as-is, and the--pathways-worker-imageflag defaults to the resolved--pathways-server-imageflag value. When you omit the sidecar flag, thegclusterCLI uses the defaultpathways/server:latestandpathways/proxy_server:latestimages.
What's next
- Follow the step-by-step guide to run workloads with Pathways.
- Learn about the Pathways architecture in Introduction to Pathways on Cloud.
- Learn how to build and verify sidecars in Run colocated Python with Pathways.
- Read the
gcluster job submitcommand reference.