About Pathways in Cluster Toolkit

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-cluster module provisions an autoscaled CPU node pool of 0 to 100 n4-standard-64 nodes named cpu-np for the Pathways coordinator:
  • Kueue configuration for Pathways: the kubectl-apply module configures Kueue for Pathways workloads:

    • Binds the pathways-flavor ResourceFlavor custom resource to the cpu-np node pool.
    • Groups the google.com/tpu, cpu, and memory resources into a single ClusterQueue resource group so worker Pods don't trigger flavor conflicts.
    • Sets the waitForPodsReady.recoveryTimeout field to a value of 0s on Kueue version 0.19.0 and later so elastic slices aren't evicted while waiting for replacement nodes.

    To customize the Kueue template, quota variables, or waitForPodsReady timeouts, configure the kueue.config_path field, the kueue.config_template_vars field, or the kueue.wait_for_pods_ready block in the kubectl-apply module.

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-rm container runs in the pathways-head Pod to manage Cloud TPU slice allocations, topology assignments, and elastic worker recovery across slices.
  • Proxy server: the pathways-proxy container runs an Interim Framework Runtime (IFRT) proxy server in the pathways-head Pod to compile and dispatch client JAX programs across the allocated Cloud TPU slices.
  • Workers and optional sidecars: the pathways-worker container runs in each Cloud TPU worker Pod to execute compiled computations, alongside an optional colocated-python-sidecar container 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, and pathways-rm containers, with enough nodes for concurrent head Pods.
  • If the default n4-standard-64 machine type on the cpu-np node pool is too small, then add a larger custom CPU node pool with a matching Kueue ClusterQueue ResourceFlavor resource and target it with the --pathways-head-np flag.
    • For example, use the n4-highmem-80 machine type with 640 GiB of memory.
    • When confidential nodes are enabled, use the n2d-highmem-96 machine type with 768 GiB of memory or the c3-highmem-88 machine type with 704 GiB of memory.

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: OnFailure setting so that worker containers restart in place after a client disconnects instead of failing the worker Job resource, allowing successful runs to complete through the JobSet successPolicy field. The --pathways-max-slice-restarts flag controls per-index worker Pod replacements before a worker failure triggers a JobSet restart under the --restarts flag limit.
  • Termination grace periods: for Pathways jobs, the --grace-period flag applies only to worker Pods while the pathways-head Pod 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 delays JobSet restarts and holds Cloud TPU slice nodes until termination completes.
  • Environment variable overrides: the gcluster CLI 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-env flags replace matching defaults in the corresponding container, including verbose logging defaults from the --verbose flag.

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_sidecar image with a release tag, the gcluster CLI automatically selects the matching cloud-pathways server and proxy images for any flag you omit.
  • Custom or digest-only sidecar image: because the gcluster CLI can't infer a release tag from a custom image or a digest-only reference, pass matching cloud-pathways --pathways-server-image and --pathways-proxy-server-image flags explicitly. When you deploy an SPS instance with the --pathways-deploy-sps flag, pass only the --pathways-server-image flag, 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-image flag you pass is preserved as-is, and the --pathways-worker-image flag defaults to the resolved --pathways-server-image flag value. When you omit the sidecar flag, the gcluster CLI uses the default pathways/server:latest and pathways/proxy_server:latest images.

What's next