This tutorial shows you how to deploy and serve the mixture of experts model
Qwen3.5-397B (Qwen/Qwen3.5-397B-A17B-FP8)
on Google Kubernetes Engine (GKE) using a single-host
TPU7x (Ironwood) accelerator and the
vLLM TPU serving framework
with TorchTPU (torchtpu). Because Qwen3.5-397B requires a minimum of four
TPU7x chips, you can run the workload on a single tpu7x-standard-4t node in a
2x2x1 topology with data parallelism and expert parallelism enabled.
Objectives
- Set up your GKE cluster and single-host TPU7x node pool.
- Deploy the single-host vLLM TorchTPU server on GKE.
- Send an inference request to the vLLM TorchTPU server.
- Run a serving benchmark workload.
- Clean up.
Costs
In this document, you use the following billable components of Google Cloud:
To generate a cost estimate based on your projected usage, use the pricing calculator.
When you finish the tasks that are described in this document, you can avoid continued billing by deleting the resources that you created. For more information, see Clean up.
Before you begin
You need a Hugging Face access token to use this tutorial. You can sign up for a free account at Hugging Face. After you have an account, generate an access token:
- On the Welcome to Hugging Face page, click your account avatar and select Access tokens.
- On the Access tokens page, click Create new token.
- Select the Read token type and enter a name for your token.
- Your access token is displayed. Save the token in a safe place.
Enable the Kubernetes Engine API in your Google Cloud project:
Enable the Artifact Registry API in your Google Cloud project:
Install and initialize the Google Cloud CLI, and install
kubectl. If you use Cloud Shell, both tools are preinstalled.Ensure that your project has sufficient SSD quota and external IP address quota in the region where your TPU capacity is located:
In the Google Cloud console, go to the Quotas & System Limits page.
Filter by Persistent Disk SSD (GB) and verify that you have at least 1,500 GB of available quota for the model cache volume.
Filter by In-use regional external IPv4 addresses and verify that you have sufficient IP address quota in your target region.
To get the permissions that you need to complete this tutorial, ask your administrator to grant you the following IAM roles on your project:
- Kubernetes Engine Admin (
roles/container.admin) - Compute Admin (
roles/compute.admin) - Service Account User (
roles/iam.serviceAccountUser)
For more information about granting roles, see Manage access to projects, folders, and organizations.
You might also be able to get the required permissions through custom roles or other predefined roles.
Set up your environment variables
Set up your authentication:
Set up your environment variables:
Replace the following:
YOUR_PROJECT_ID: the ID of your Google Cloud project.YOUR_REGION: the region where you want to deploy your cluster, such asus-central1.YOUR_ZONE: the zone where you want to deploy your TPU7x node pool, such asus-central1-c.YOUR_CLUSTER_NAME: the name of your GKE cluster, such astpu7x-tutorial-cluster.YOUR_RESERVATION_NAME: if you're using a reservation, the name of your TPU7x reservation.YOUR_HF_TOKEN: your Hugging Face access token.YOUR_NETWORK_NAME: the name of your Google Cloud network. If you created a custom network, then specify that network. Otherwise, specifydefault.YOUR_SUBNETWORK_NAME: the name of your Google Cloud subnetwork. If you created a custom subnetwork, then specify that subnetwork. Otherwise, specifydefault.YOUR_VLLM_TPU_IMAGE: the vLLM TorchTPU image to use. For public images, refer to the vLLM TorchTPU repository.
Create the GKE cluster
To create a GKE cluster in Standard mode and attach a single-host TPU7x node pool, complete the following steps:
Create a regional GKE cluster:
The output is similar to the following:
NAME LOCATION MASTER_VERSION MASTER_IP MACHINE_TYPE NODE_VERSION NUM_NODES STATUS tpu7x-tutorial-cluster us-central1 1.35.7-gke.1027000 34.63.222.246 n2-standard-16 1.35.7-gke.1027000 3 RUNNINGCreate a single-host TPU7x node pool with one
tpu7x-standard-4tnode (four TPU7x chips in a2x2x1topology) using your reservation:Instead of using a specific reservation, you can also create the node pool using Spot capacity or Flex-start VMs by passing the following flags:
- Spot VMs: replace the
--reservation-affinityand--reservationflags with--spotto use Spot capacity. Instances using Spot capacity might take time to be created after the node pool is created, and they might be preempted during workload runs. If your Pods take time to be created, or workloads stop in the middle of running, this could be the cause. - Flex-start VMs: pass the
--flex-startflag to provision the node pool using the Flex-start consumption option. For more information, see Run a small batch workload with TPUs and Flex-start VMs.
The output is similar to the following:
NAME MACHINE_TYPE DISK_SIZE_GB NODE_VERSION np-0 tpu7x-standard-4t 100 1.35.7-gke.1027000- Spot VMs: replace the
Configure
kubectlcredentials to communicate with your cluster:
Configure credentials
Create a Kubernetes Secret named hf-secret to store your Hugging Face access
token:
Deploy the vLLM TorchTPU server
The workload manifest (qwen3_5_server.yaml) defines the following resources:
- A StorageClass (
hyperdisk-balanced-qwen3-5) and a 1,500 GiB PersistentVolumeClaim (hd-claim-qwen3-5) backed by Google Cloud Hyperdisk Balanced storage to store the downloaded model weights, XLA compilation cache, and PyTorch compile cache. - A Deployment (
vllm-qwen3-5) scheduled on a single TPU7x node with a2x2x1topology (google.com/tpu: '4'). The container runsvllm serveforQwen/Qwen3.5-397B-A17B-FP8with--data-parallel-size=8,--tensor-parallel-size=1,--enable-expert-parallel,--kv-cache-dtype=fp8,--max-model-len=9236, and--max-num-seqs=64. - A
ClusterIPService (vllm-qwen3-5-service) that exposes port8000.
To deploy and monitor the workload, complete the following steps:
Fetch the server manifest:
Alternately, you can choose to create a file named
qwen3_5_server.yamlwith the following content:Apply the vLLM TorchTPU server manifest to your cluster:
Monitor the server deployment logs until application startup completes:
Initial service startup might take approximately 20 to 30 minutes while the Pod downloads the model weights and compiles the model.
If you're using preemptive capacity like Spot or Flex-start, it might take longer after node pool creation for your TPU slice nodes to be created, and they can be preempted during workload runs. If your Pods are taking longer than expected to start, or your workloads stop in the middle, this could be the cause. For more information, see Preemption of Spot VMs. To check if your TPU slice nodes have been created, see Check the node's status and conditions.
Wait until the logs report
Application startup completebefore you send traffic:(APIServer pid=1) INFO: Started server process [1] (APIServer pid=1) INFO: Waiting for application startup. (APIServer pid=1) INFO: Application startup complete.Open a second terminal session.
In your second terminal session, forward local port
8000tovllm-qwen3-5-service:Leave port forwarding running in this terminal session.
Send inference requests
Return to your first terminal session and send a chat completion request to the
/v1/chat/completions endpoint:
Run a benchmark workload
To benchmark the deployed Qwen3.5 397B model using an 8,192-token input and 1,024-token output (8k/1k) workload with the InferenceX benchmark suite, complete the following steps:
Fetch the benchmark manifest:
Alternately, create a file named
qwen3_5-benchmark-8k1k.yamlwith the following content:Apply the benchmark Pod manifest:
Monitor the benchmark logs:
The benchmark takes approximately 25 to 30 minutes to complete.
Clean up
To avoid incurring additional ongoing charges to your Google Cloud account for the resources used in this tutorial, delete the Kubernetes workloads, the TPU node pool, and the GKE cluster:
Delete the vLLM TorchTPU server Deployment, Service, PersistentVolumeClaim, and benchmark Pod:
Delete the TPU7x node pool and the GKE cluster:
What's next
- Learn more about vLLM on Cloud TPU.
- Learn more about TPU7x (Ironwood).
- Learn more about Cloud TPU.