This tutorial shows you how to fine-tune, evaluate, and serve a vision-language-action (VLA) model for robot manipulation on Google Kubernetes Engine (GKE). A VLA model is also known as a robotics foundation model or a physical AI model. You use Ray and the KubeRay operator to run a complete robot learning pipeline on a single GKE cluster.
In this tutorial, you stream multi-camera robot demonstration data from Cloud Storage, fine-tune the Physical Intelligence PI0.5 model across 8 GPUs, evaluate the fine-tuned policy in parallel robot arm simulations, and deploy the policy as a long-running inference service.
This tutorial uses a single node that has 8 NVIDIA RTX PRO 6000 GPUs
(96 GB of GPU memory each) on the g4-standard-384 machine type. The
accelerator configuration that you need depends on the training batch size,
simulation concurrency, and model parameters. You can adapt the workload to
other multi-GPU configurations, such as NVIDIA L4, A100, or H100 GPUs. For more
information, see
Run the sample on smaller or alternative GPU node pools.
This tutorial is intended for Machine learning (ML) engineers, Platform admins and operators, and Data and AI specialists who want to use Kubernetes container orchestration for robotics model fine-tuning and closed-loop simulation. To learn more about common roles and example tasks referenced in Google Cloud content, see Common GKE user roles and tasks.
Background
The following sections provide a brief overview of the concepts used in this tutorial.
Vision-language-action models
A vision-language-action (VLA) model takes camera images, a natural-language task instruction, and the current robot state as input, and predicts the robot actions to perform next. In this tutorial, the model predicts action chunks, which are sequences of 50 future robot actions.
For more information, see Robotics foundation models.
Physical Intelligence PI0.5
PI0.5 is a 3.4-billion parameter robotics foundation model from Physical Intelligence. The model combines the following components:
- A vision-language transformer backbone (PaliGemma) that stays frozen during fine-tuning.
- Trainable Action Expert projection multi-layer perceptron (MLP) heads that predict 50-step action chunks. These heads train with a flow matching loss.
For more information, see Physical Intelligence openpi.
LIBERO robotics dataset
In this tutorial, you use demonstration data in the LIBERO robotics benchmark format. The dataset contains 37 manipulation tasks across 1,693 episodes and 273,465 frames. Each frame includes images from two cameras, the robot joint state, and the robot action.
For more information, see LIBERO.
Ray on GKE
Ray is an open-source framework for distributed compute. The Ray Operator add-on for GKE installs KubeRay, which manages Ray workloads by using Kubernetes custom resources. This tutorial uses the following Ray libraries and KubeRay resources:
- Ray Data: streams and decodes the demonstration dataset.
- Ray Train: runs Distributed Data Parallel (DDP) fine-tuning with PyTorch across 8 GPUs.
- Ray Serve: serves the policy for simulation and inference.
- RayJob resource: creates a Ray cluster, runs a batch job, and then deletes the Ray cluster.
- RayService resource: runs a long-lived, self-healing Ray Serve application.
For more information, see About Ray on GKE.
Robot arm simulation
To evaluate the fine-tuned policy, the tutorial runs parallel simulations of a Franka Panda robot arm. Each simulation worker queries the served policy, steps through the simulated environment, and records camera observations and rewards. The pipeline adds high-reward trajectories to the training data and retrains the policy, which creates a closed-loop retraining cycle.
Architecture
The following diagram shows the components of the robot learning pipeline on GKE:
The pipeline runs in the following stages:
- Robotics data pipeline: Ray Data streams the 37 LIBERO tasks directly from Cloud Storage by using Cloud Storage FUSE. Workers decode H.264 video streams with PyAV as they read the data, and then assemble multimodal training batches.
- Distributed fine-tuning: Ray Train runs DDP training across 8 GPUs on a single node. The Action Expert heads train for 1,000 steps with FP16 mixed precision, and the Job saves the checkpoint to Cloud Storage.
- Demonstration generation and closed-loop retraining: a Kubernetes Job generates expert demonstrations. Ray Serve then deploys the policy on GPU 0 while 8 simulation workers run across all 8 GPUs. The pipeline filters and normalizes the evaluated trajectories, merges them with any expert demonstrations that are stored in Cloud Storage, and retrains the policy.
- Persistent policy serving: KubeRay deploys a RayService resource that
exposes port
8000through a Kubernetes ClusterIP Service for continuous inference.
Objectives
This tutorial shows you how to fine-tune and serve a VLA model on GKE by completing the following steps:
- Create a GKE Standard cluster with the Ray Operator and Cloud Storage FUSE CSI driver add-ons.
- Configure Workload Identity Federation for GKE and create the Kubernetes storage resources.
- Stream and process robot demonstration data with Ray Data.
- Fine-tune the PI0.5 model across 8 GPUs with Ray Train and PyTorch DDP.
- Generate expert manipulation trajectories for a Franka Panda robot arm.
- Evaluate policy rollouts in parallel simulated environments by using Ray Serve.
- Deploy the fine-tuned policy as a self-healing RayService resource.
Before you begin
-
Install the Google Cloud CLI.
-
Configure the gcloud CLI to use your federated identity.
For more information, see Sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init -
Create or select a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Create a Google Cloud project:
gcloud projects create PROJECT_ID
Replace
PROJECT_IDwith a name for the Google Cloud project you are creating. -
Select the Google Cloud project that you created:
gcloud config set project PROJECT_ID
Replace
PROJECT_IDwith your Google Cloud project name.
-
Verify that billing is enabled for your Google Cloud project.
Enable the required APIs, if any are not already enabled:
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.gcloud services enable container.googleapis.com
compute.googleapis.com storage.googleapis.com -
Grant roles to your user account. Run the following command once for each of the following IAM roles:
roles/container.admin, roles/storage.admingcloud projects add-iam-policy-binding PROJECT_ID --member="user:USER_IDENTIFIER" --role=ROLE
Replace the following:
PROJECT_ID: Your project ID.USER_IDENTIFIER: The identifier for your user account. For examples, see Represent workforce pool users in IAM policies.ROLE: The IAM role that you grant to your user account.
Ensure that your project has sufficient GPU quota in your region for 8 GPUs on a single node:
- For on-demand NVIDIA RTX PRO 6000 GPUs, check the regional quota for
GPU_FAMILY:NVIDIA_RTX_PRO_6000(quota IDGPUS-PER-GPU-FAMILY-per-project-regionwith dimensiongpu_family=NVIDIA_RTX_PRO_6000). For Spot VMs, checkPREEMPTIBLE_NVIDIA_RTX_PRO_6000_GPUS. - If you adapt the sample to other GPU types, such as NVIDIA L4, A100, or H100 GPUs, then check the quota for those accelerators.
To learn more, see Plan GPU quota and GPU quota.
- For on-demand NVIDIA RTX PRO 6000 GPUs, check the regional quota for
Prepare your environment
In this tutorial, you use Cloud Shell.
Go to the Google Cloud console.
At the top of the Google Cloud console window, click the Activate Cloud Shell button.
Set the environment variables:
export PROJECT_ID=$(gcloud config get-value project) export REGION=YOUR_REGION export ZONE=YOUR_ZONE export CLUSTER_NAME=YOUR_CLUSTER_NAME export GCS_BUCKET_NAME=YOUR_BUCKET_NAME export K8S_SA_NAME=workload-identity-k8s-sa export K8S_NAMESPACE=default export PROJECT_NUMBER=$(gcloud projects describe ${PROJECT_ID} --format="value(projectNumber)")Replace the following values:
YOUR_REGION: the Compute Engine region for your cluster and Cloud Storage bucket, for example,us-central1.YOUR_ZONE: the zone for your GPU nodes, for example,us-central1-b. Select a zone where your GPUs are available.YOUR_CLUSTER_NAME: the name of your GKE cluster.YOUR_BUCKET_NAME: a globally unique name for your Cloud Storage bucket. You don't need to specify thegs://prefix.
The sample manifests use the
workload-identity-k8s-saKubernetes ServiceAccount in thedefaultnamespace, so don't change the values of theK8S_SA_NAMEandK8S_NAMESPACEvariables. ThePROJECT_NUMBERvariable stores your project number, which you use to grant the Kubernetes ServiceAccount access to your bucket.Clone the sample repository:
git clone https://github.com/GoogleCloudPlatform/kubernetes-engine-samples.gitNavigate to the working directory:
cd kubernetes-engine-samples/ai-ml/physical-ai-on-gkeIn the rest of the tutorial, look in this directory to find the files that you need to inspect or apply.
Set up infrastructure
In this section, you create the GKE cluster and the GPU node pool.
Create a Standard cluster with Workload Identity Federation for GKE, the Ray Operator add-on, and the Cloud Storage FUSE CSI driver add-on enabled:
gcloud container clusters create ${CLUSTER_NAME} \ --location=${REGION} \ --release-channel=stable \ --machine-type=e2-standard-8 \ --num-nodes=1 \ --workload-pool=${PROJECT_ID}. \ --addons=RayOperator=ENABLED,GcsFuseCsiDriver=ENABLEDThe default node pool runs the CPU-only Kubernetes Jobs that stage data and generate demonstrations. These Jobs request up to 4 vCPUs and 16 GiB of memory, so the command uses the
e2-standard-8machine type. The--num-nodes=1flag creates one node in each zone of the region.Create a GPU node pool with one
g4-standard-384node that has 8 NVIDIA RTX PRO 6000 GPUs:gcloud container node-pools create gpu-pool-8x \ --cluster=${CLUSTER_NAME} \ --location=${REGION} \ --node-locations=${ZONE} \ --machine-type=g4-standard-384 \ --accelerator=type=nvidia-rtx-pro-6000,count=8,gpu-driver-version=latest \ --num-nodes=1 \ --no-enable-autoscalingGet credentials for your cluster:
gcloud container clusters get-credentials ${CLUSTER_NAME} \ --location=${REGION}
Prepare data and storage
All stages of this tutorial read datasets and store checkpoints in a single
Cloud Storage bucket. The Ray Pods mount the bucket at the /checkpoint
path by using the Cloud Storage FUSE CSI driver.
Create the bucket and configure access
Create a Cloud Storage bucket:
gcloud storage buckets create gs://${GCS_BUCKET_NAME} \ --location=${REGION} \ --uniform-bucket-level-accessGrant the Kubernetes ServiceAccount permission to manage objects in your bucket by using Workload Identity Federation for GKE:
gcloud storage buckets add-iam-policy-binding gs://${GCS_BUCKET_NAME} \ --member="principal://iam.googleapis.com/projects/${PROJECT_NUMBER}/locations/global/workloadIdentityPools/${PROJECT_ID}./subject/ns/${K8S_NAMESPACE}/sa/${K8S_SA_NAME}" \ --role="roles/storage.objectAdmin"This command grants the
roles/storage.objectAdminrole directly to theworkload-identity-k8s-saKubernetes ServiceAccount in thedefaultnamespace. You can grant the role before the ServiceAccount exists. You create the ServiceAccount in the next section.
Create the Kubernetes storage resources
Inspect the
00-infrastructure.yamlmanifest:This manifest defines the following resources:
- A ServiceAccount resource named
workload-identity-k8s-sa, which the Ray Pods use to access your bucket. This ServiceAccount has theroles/storage.objectAdminrole on your bucket that you granted in the previous section. - A PersistentVolume resource that uses the
gcsfuse.csi.storage.gke.ioCSI driver. ThevolumeHandlefield specifies the bucket to mount. - A PersistentVolumeClaim resource named
physical-ai-checkpoint-pvcthat requests the volume with theReadWriteManyaccess mode.
The
volumeHandlefield contains theGCS_BUCKET_NAMEplaceholder. You must replace this placeholder before you apply the manifest.- A ServiceAccount resource named
Replace the
GCS_BUCKET_NAMEplaceholder in the manifest with your bucket name, and then apply the manifest:sed "s/GCS_BUCKET_NAME/${GCS_BUCKET_NAME}/g" \ models/pi05/manifests/00-infrastructure.yaml | kubectl apply -f -The
GCS_BUCKET_NAMEenvironment variable contains your bucket name without thegs://prefix. If you include the prefix, then the Cloud Storage FUSE CSI driver can't mount the bucket.Verify that the PersistentVolume references your bucket:
kubectl get pv physical-ai-checkpoint-pv \ -o jsonpath='{.spec.csi.volumeHandle}{"\n"}'The output is your bucket name. If the output is
GCS_BUCKET_NAME, then delete the PersistentVolumeClaim and PersistentVolume, and run thesedcommand from the previous step again:kubectl delete pvc physical-ai-checkpoint-pvc kubectl delete pv physical-ai-checkpoint-pvVerify that the status of the PersistentVolumeClaim is
Bound:kubectl get pvc physical-ai-checkpoint-pvcThe output is similar to the following:
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE physical-ai-checkpoint-pvc Bound physical-ai-checkpoint-pv 64Gi RWX 12s
Publish scripts and tools as ConfigMaps
To make the Python training scripts and environment tools available inside your Ray Pods without building a custom container image, publish them as Kubernetes ConfigMaps:
kubectl create configmap physical-ai-scripts \
--from-file=models/pi05/scripts/ \
--dry-run=client -o yaml | kubectl apply -f -
kubectl create configmap physical-ai-tools \
--from-file=models/pi05/tools/ \
--dry-run=client -o yaml | kubectl apply -f -
Stage the dataset and pretrained model weights
The sample uses LIBERO demonstration data and pretrained PI0.5 weights.
Inspect the
00-mirror-sync-job.yamlmanifest, which configures a Kubernetes Job that copies the demonstration data and base weights into your bucket:Apply the manifest:
kubectl apply -f models/pi05/manifests/00-mirror-sync-job.yamlWait for the Job to complete:
kubectl wait --for=condition=complete job/physical-ai-mirror-sync --timeout=3600s
Deploy RayCluster for data processing
In this section, you submit a RayJob resource. KubeRay creates a Ray cluster for the job, runs the robotics data pipeline, and then deletes the Ray cluster. The pipeline reads multi-camera demonstration episodes directly from Cloud Storage FUSE, without downloading files to local node disks.
The 01_robotics_data_pipelines.py script performs the following operations:
- Streams the 37 LIBERO tasks from the
/checkpoint/physical-ai/mirror/liberodirectory. - Decodes the H.264 camera streams
observation.images.imageandobservation.images.image2by using PyAV while the data streams. - Extracts 8-dimensional robot joint states from the
observation.statefield and 7-dimensional actions from theactionfield. - Validates the dimensions of the multimodal tensor batches for training.
The following animation shows how a Ray Data read task streams one demonstration row from Cloud Storage:
To deploy the data processing workload, do the following:
Inspect the
01-data-processing-rayjob.yamlmanifest:Apply the manifest:
kubectl apply -f models/pi05/manifests/01-data-processing-rayjob.yamlMonitor the status of the RayJob resource:
kubectl get rayjob physical-ai-01-data-processing -wView the logs from the submitter Pod. KubeRay creates a Kubernetes Job with the same name as the RayJob resource to submit the Ray job, so you can read the logs from that Job:
kubectl logs -f job/physical-ai-01-data-processing
In a verified test run, the job completed with the SUCCEEDED status in
32 seconds and produced the following results:
| Metric | Result |
|---|---|
| Frames streamed | 273,465 frames from 37 tasks and 1,693 episodes |
| Validation latency | 8.43 seconds for PyAV decoding and Apache Arrow table assembly |
| Batch tensor shapes |
|
Launch the VLA fine-tuning job
In this section, you fine-tune the PI0.5 model across 8 GPUs by using Ray Train in DDP mode. The training job uses the following configuration:
- Architecture: the PaliGemma backbone stays frozen in FP16 precision. Training updates only the Action Expert MLP heads, which have 27,270,158 trainable parameters.
- Objective: behavior cloning with a continuous-time flow matching loss that predicts 50-step action chunks.
- Distributed engine: the Ray Train
TorchTrainerclass coordinates 8 DDP worker processes across 8 GPUs. - Optimization: the
AdamWoptimizer with cosine learning rate decay and linear warmup (lr=5e-5), a batch size of 16 for each worker, and a gradient accumulation of 1, for an effective batch size of 128.
To launch the fine-tuning job, do the following:
If an earlier run of the training job exists, then delete it:
kubectl delete rayjob physical-ai-02-vla-finetuning --ignore-not-found=trueInspect the
02-vla-training-rayjob.yamlmanifest:Apply the manifest:
kubectl apply -f models/pi05/manifests/02-vla-training-rayjob.yamlView the training logs from the submitter Pod:
kubectl logs -f job/physical-ai-02-vla-finetuning
In a verified test run of 1,000 training steps, the job produced the following results:
| Metric | Result |
|---|---|
| Duration | 1,000 optimizer updates in 1,571.2 seconds, about 0.64 steps per second |
| Cluster topology | 8 NVIDIA RTX PRO 6000 GPUs (world_size=8) that run
PyTorch DDP |
| Peak GPU memory | 14.4 GB per GPU, out of 96 GB available |
| Held-out validation loss | 0.5699 to 0.1775, a 68.9% improvement on 4 validation episodes (1,128 rows) |
| Saved checkpoint | /checkpoint/physical-ai/checkpoint_round1/state.pkl
(24.8 MiB) |
kubectl logs $(kubectl get pods -o name | grep 'physical-ai-02-vla-finetuning-' | grep -vE 'head|worker' | head -1) > 02-vla-training.log
kubectl delete rayjob physical-ai-02-vla-finetuning --wait=true
Generate expert demonstrations
In this section, you generate high-reward demonstration trajectories for Franka Panda manipulation. If you store these trajectories in your bucket, then they provide kinematic grounding for coordinate normalization during closed-loop retraining.
The generate_franka_demos.py script writes the demonstrations to the
/checkpoint/physical-ai/franka_demos directory only if that directory already
exists in your bucket. Otherwise, the script writes them to the
/tmp/franka_demos directory in the Job Pod, and the demonstrations are
deleted when the Pod ends. In that case, the closed-loop retraining stage
doesn't use the demonstrations.
Optional: to store the demonstrations in your bucket so that the closed-loop retraining stage uses them, create the
franka_demosdirectory in your bucket:echo -n | gcloud storage cp - gs://${GCS_BUCKET_NAME}/physical-ai/franka_demos/.keepThis command creates an empty placeholder object. Because the PersistentVolume uses the
implicit-dirsmount option, Cloud Storage FUSE shows thefranka_demosdirectory in the/checkpointmount.Inspect the
02b-generate-demos-job.yamlmanifest:Apply the manifest:
kubectl apply -f models/pi05/manifests/02b-generate-demos-job.yamlWait for the Job to complete:
kubectl wait --for=condition=complete job/physical-ai-generate-demos --timeout=3600sCheck where the Job saved the demonstrations:
kubectl logs job/physical-ai-generate-demos | grep "Saved to"If you created the
franka_demosdirectory, then the output is similar to the following:Saved to: /checkpoint/physical-ai/franka_demos/expert_dataset.pklIf the output shows the
/tmp/franka_demosdirectory, then the demonstrations aren't stored in your bucket.
The Job generates 25 expert episodes in the expert_dataset.pkl file. The
episodes contain 2,500 frames of pick-and-lift execution, with an average
episode reward of +87.86.
Evaluate the policy in simulation
In this section, you connect model serving, parallel simulation, and retraining in a closed loop:
- Model serving: Ray Serve deploys the
PI05PolicyServerdeployment on GPU 0 and exposes an HTTP/predictendpoint. - Parallel simulation: 8 Franka Panda simulation workers run on GPUs 0-7. Worker 0 shares GPU 0 with Ray Serve. The workers query the served policy over HTTP, step through the simulated environment, and record observation images and rewards.
Closed-loop retraining: the pipeline extracts high-reward trajectories, merges them with the demonstration dataset by using the
ray.data.unionmethod, and then retrains the policy on 8 GPUs for 100 steps. The pipeline includes the expert demonstrations only if the/checkpoint/physical-ai/franka_demos/expert_dataset.pklfile exists. If no expert demonstrations or high-reward trajectories are available, then the pipeline retrains the policy on the base LIBERO dataset, and the logs show the following message:No demonstration or sim frames available; using base dataset.
To run the simulation and retraining workload, do the following:
Inspect the
03-serving-sim-eval-rayjob.yamlmanifest:Apply the manifest:
kubectl apply -f models/pi05/manifests/03-serving-sim-eval-rayjob.yamlView the logs from the submitter Pod:
kubectl logs -f job/physical-ai-03-serving-sim-eval
Best practice: This stage demonstrates the closed-loop pattern end to end on GKE. For production robotics pipelines, replace the simplified kinematic environment with a high-fidelity physics simulator, such as NVIDIA Isaac Lab or MuJoCo. Also increase the number of evaluation episodes and reduce the retraining learning rate.
Serve the fine-tuned policy
In this section, you deploy the fine-tuned policy as a long-running,
self-healing RayService resource. The 03b-vla-serving-rayservice.yaml
manifest deploys a dedicated Ray cluster and a Ray Serve application with the
following configuration:
- Allocates 1 GPU (
cuda:0) and 4 vCPUs to thePI05PolicyServerdeployment. This configuration shows inference on a single GPU. - Loads the fine-tuned checkpoint from the
/checkpoint/physical-ai/checkpoint_round1/state.pklfile. - Exposes port
8000through thephysical-ai-vla-serving-head-svcClusterIP Service.
Deploy the RayService
Inspect the
03b-vla-serving-rayservice.yamlmanifest:Apply the manifest:
kubectl apply -f models/pi05/manifests/03b-vla-serving-rayservice.yamlVerify that the status of the RayService resource is
Running:kubectl get rayservice physical-ai-vla-servingThe output is similar to the following:
NAME SERVICE STATUS NUM SERVE ENDPOINTS AGE physical-ai-vla-serving Running 2 45s
Send inference requests
Forward local port
8000to the RayService head Service:kubectl port-forward svc/physical-ai-vla-serving-head-svc 8000:8000This command keeps your terminal busy while the session is active. To continue, open a separate terminal.
In a separate terminal, check the health status of the service:
curl -s http://localhost:8000/stats | jq .Send an inference request that contains images from two cameras, an 8-dimensional robot state vector, and a task instruction:
python3 -c " import urllib.request, pickle, numpy as np obs = { 'observation.images.image': np.zeros((224, 224, 3), dtype=np.uint8), 'observation.images.image2': np.zeros((224, 224, 3), dtype=np.uint8), 'observation.state': np.zeros(8, dtype=np.float32), 'task': 'pick up the alphabet soup and put it in the basket', } req = urllib.request.Request( 'http://localhost:8000/predict', data=pickle.dumps(obs), headers={'Content-Type': 'application/octet-stream'} ) res = pickle.loads(urllib.request.urlopen(req).read()) print('Action Chunk Shape:', res['action'].shape) "The output shows that the service returns a 50-step action trajectory:
Action Chunk Shape: (50, 7)In a verified test run, the deployment returned an inference result in 371.37 ms for each forward pass.
Clean up
To avoid incurring charges to your Google Cloud account for the resources used in this tutorial, either delete the individual resources, or delete the project that contains them.
Delete the resources
Delete the Ray workloads and Kubernetes Jobs:
kubectl delete rayjob physical-ai-01-data-processing --ignore-not-found=true kubectl delete rayjob physical-ai-02-vla-finetuning --ignore-not-found=true kubectl delete rayjob physical-ai-03-serving-sim-eval --ignore-not-found=true kubectl delete job physical-ai-mirror-sync --ignore-not-found=true kubectl delete job physical-ai-generate-demos --ignore-not-found=true kubectl delete rayservice physical-ai-vla-serving --ignore-not-found=trueDelete the ConfigMaps, PersistentVolumeClaim, PersistentVolume, and ServiceAccount:
kubectl delete configmap physical-ai-scripts physical-ai-tools --ignore-not-found=true kubectl delete pvc physical-ai-checkpoint-pvc --ignore-not-found=true kubectl delete pv physical-ai-checkpoint-pv --ignore-not-found=true kubectl delete serviceaccount workload-identity-k8s-sa --ignore-not-found=trueIf you created a dedicated GKE cluster for this tutorial, then delete the cluster:
gcloud container clusters delete ${CLUSTER_NAME} \ --location=${REGION} \ --quietDelete the Cloud Storage bucket and all stored checkpoints:
gcloud storage rm -r gs://${GCS_BUCKET_NAME}
Delete your project
Delete a Google Cloud project:
gcloud projects delete PROJECT_ID
Troubleshoot
This section describes how to diagnose and resolve common issues when you run this tutorial.
Pods stay pending because of insufficient GPUs
Symptom: Ray worker Pods or submitter Pods stay in the Pending or
Initializing state. The output of the kubectl describe pod command shows
the following event:
Warning FailedScheduling 0/1 nodes are available: 1 Insufficient nvidia.com/gpu.
Cause: when a RayJob resource finishes, its Ray cluster stays active
until the duration in the ttlSecondsAfterFinished field elapses. If this
field is omitted or greater than 0, the completed Ray cluster holds all
8 GPUs, and the next stage can't schedule.
Resolution:
List the active Ray clusters:
kubectl get rayclustersDelete the completed RayJob resource before you submit the next stage:
kubectl delete rayjob physical-ai-02-vla-finetuning --wait=trueIn multi-stage workflows, set the
ttlSecondsAfterFinishedfield to0in all RayJob manifests.
Binary incompatibility error with NumPy 2.x
Symptom: Ray worker tasks fail on import with the following error:
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
Cause: in the rayproject/ray:2.55.1 image, the C extensions for
ray.data, ray.train, pandas, and scipy are compiled against the
NumPy 1.x Application Binary Interface (ABI). If an unpinned dependency
installs NumPy 2.x, the binary incompatibility causes import failures.
Resolution: pin NumPy to the 1.26 release branch (numpy>=1.26,<2) and cap
opencv-python-headless<4.10 in your dependencies script. In the sample, the
setup_vla_deps.sh script sets these pins. If you customize packages, then keep
these version restrictions.
To check the installed NumPy version in the Ray container image, run the following command in the container:
python3 -c "import numpy; print(numpy.__version__)"
Import error for PyArrow with NumPy 1.x
Symptom: the fine-tuning RayJob resource ends in the FAILED state, and the
logs show the following errors:
ImportError: pyarrow requires NumPy 2.0 or newer, found 1.26.4
ImportError: Can't import ray.train as some dependencies are missing.
Cause: the setup_vla_deps.sh script pins NumPy to 1.x and installs the
datasets package, which requires PyArrow 21.0.0 or later. If PyArrow isn't
pinned, then pip upgrades PyArrow to the latest release. PyArrow 26.0.0 and
later require NumPy 2.x, so the ray.train import fails.
Resolution: do the following:
In the
models/pi05/tools/setup_vla_deps.shscript, add a PyArrow version pin to thepip installcommand, after the NumPy pin:python3 -m pip install --no-cache-dir \ "numpy>=1.26,<2" \ "pyarrow>=21,<26" \ ...PyArrow versions 21.0.0 through 25.0.0 work with NumPy 1.26.4, Ray Data, and Ray Train in the
rayproject/ray:2.55.1-py311image.Update the
physical-ai-toolsConfigMap with the modified script:kubectl create configmap physical-ai-tools \ --from-file=models/pi05/tools/ \ --dry-run=client -o yaml | kubectl apply -f -Delete the failed RayJob resource, and then submit it again:
kubectl delete rayjob physical-ai-02-vla-finetuning --wait=true kubectl apply -f models/pi05/manifests/02-vla-training-rayjob.yaml
Permission denied when accessing the Cloud Storage FUSE mount
Symptom: Ray Pods fail to read datasets or write checkpoints in the
/checkpoint directory, with errors such as PermissionDenied or
StorageException: 403 Forbidden.
Cause: the workload-identity-k8s-sa Kubernetes ServiceAccount doesn't
have the roles/storage.objectAdmin role on the bucket, or the
PersistentVolume references the wrong bucket.
Resolution:
Verify that the PersistentVolume references your bucket name, not the
GCS_BUCKET_NAMEplaceholder:kubectl get pv physical-ai-checkpoint-pv \ -o jsonpath='{.spec.csi.volumeHandle}{"\n"}'If the output is incorrect, then delete the PersistentVolumeClaim and PersistentVolume, and apply the
00-infrastructure.yamlmanifest again with thesedcommand from Create the Kubernetes storage resources.Check the IAM policy on your bucket:
gcloud storage buckets get-iam-policy gs://${GCS_BUCKET_NAME}The output must include a binding for the
roles/storage.objectAdminrole with aprincipal://member that ends insubject/ns/default/sa/workload-identity-k8s-sa.If the binding is missing, then grant the role to the Kubernetes ServiceAccount again:
gcloud storage buckets add-iam-policy-binding gs://${GCS_BUCKET_NAME} \ --member="principal://iam.googleapis.com/projects/${PROJECT_NUMBER}/locations/global/workloadIdentityPools/${PROJECT_ID}./subject/ns/${K8S_NAMESPACE}/sa/${K8S_SA_NAME}" \ --role="roles/storage.objectAdmin"
Pods take several minutes to start
Symptom: Ray Pods take 3-5 minutes to move from the PodInitializing state
to the Running state.
Cause: the sample uses the public rayproject/ray:2.55.1-py311-gpu image,
which doesn't include PyTorch with CUDA 12.8 support. During Pod
initialization, the setup_vla_deps.sh startup script downloads and installs
PyTorch (about 820 MB) and other VLA dependencies.
To view the container logs during startup, run the following command:
kubectl logs -f RAY_POD_NAME -c ray-head
Replace RAY_POD_NAME with the name of your Ray Pod.
Resolution: for production deployments, build a container image that
includes PyTorch and the VLA dependencies, push the image to Artifact Registry, and
specify your image in the image field of your RayJob and RayService
manifests. This approach removes the dependency installation at startup.
Run the sample on smaller or alternative GPU node pools
To run the sample on a node pool with fewer than 8 GPUs, or with other GPU models such as NVIDIA L4, A100, or H100 GPUs, update the manifests as follows:
- In the
02-vla-training-rayjob.yamlmanifest, make the following changes:- Set the
resources.requests.nvidia.com/gpuandresources.limits.nvidia.com/gpufields to your GPU count, for example,4. - In the
entrypointfield, set the--num-workersflag to your GPU count, for example,--num-workers 4.
- Set the
- In the
03-serving-sim-eval-rayjob.yamlmanifest, make the following changes:- Update the GPU resource requests and limits.
- In the
entrypointfield, adjust the--sim-workersflag.
If your cluster has multiple node pools, then add a
nodeSelectorfield to pin the Pods to your GPU node pool:nodeSelector: cloud.google.com/gke-nodepool: YOUR_GPU_NODE_POOL_NAMEReplace
YOUR_GPU_NODE_POOL_NAMEwith the name of your GPU node pool.
What's next
- Explore the sample code in the kubernetes-engine-samples repository.
- Learn about Ray on GKE.
- Access Cloud Storage buckets with the Cloud Storage FUSE CSI driver.
- Run GPUs in GKE Standard node pools.
- Harden your cluster's security.