This tutorial shows you how to deploy and serve a [DeepSeek-V3.2-Speciale](https://huggingface.co/deepseek-ai/DeepSeek-V3.2-Speciale) language model by using the [vLLM framework](https://github.com/vllm-project/vllm). You deploy this model on a Google Kubernetes Engine (GKE) Autopilot cluster and consume a single [A4 virtual machine](https://cloud.google.com/compute/docs/gpus#b200-gpus) (VM) that has eight B200 GPUs.

This tutorial assumes that you have reviewed the DeepSeek-V3.2-Speciale language model and checked that its capabilities meet the requirements of your use case.

> [!IMPORTANT]
> **Important:** To complete this tutorial, you must have reserved the capacity to create an A4 VM. To learn more about your options for reserving capacity in AI Hypercomputer for a future date and time, see [Choose a consumption option](https://docs.cloud.google.com/ai-hypercomputer/docs/consumption-models).

This tutorial is intended for machine learning (ML) engineers, platform administrators and operators, and for data and AI specialists who are interested in using Kubernetes container orchestration capabilities to handle inference workloads.

## Objectives

1. Access DeepSeek-V3.2-Speciale by using Hugging Face.

2. Prepare your environment.

3. Create a GKE cluster in Autopilot mode.

4. Create a Kubernetes secret for Hugging Face credentials.

5. Deploy a vLLM container to your GKE cluster.

6. Interact with DeepSeek-V3.2-Speciale by using curl.

7. Clean up.

## Costs

This tutorial uses billable components of Google Cloud, including:

- [Google Kubernetes Engine pricing](https://docs.cloud.google.com/kubernetes-engine/pricing)
- [GPU pricing](https://cloud.google.com/compute/gpus-pricing)

<br />

To generate a cost estimate based on your projected usage, use the [Pricing Calculator](https://cloud.google.com/products/calculator).

## Before you begin

1. Grant roles to your user account. Run the following command once for each of the following IAM roles: `roles/container.admin`

   ```bash
   gcloud 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 example, `myemail@example.com`.
   - `ROLE`: The IAM role that you grant to your user account.
2. [Sign in to or create a Hugging Face account](https://huggingface.co/login).

<br />

## Access DeepSeek-V3.2-Speciale by using Hugging Face

To use Hugging Face to access the DeepSeek-V3.2-Speciale model, do the following:

1. [Sign in to Hugging face](https://huggingface.co/deepseek-ai/DeepSeek-V3.2-Speciale).
2. [Create a Hugging Face `read` access token](https://huggingface.co/docs/hub/security-tokens#how-to-manage-user-access-tokens).
3. Copy and save the `read` access token value. You use it later in this tutorial.

## Prepare your environment

To prepare your environment, set the following variables:

    gcloud config set project PROJECT_ID
    gcloud config set billing/quota_project PROJECT_ID
    export PROJECT_ID=$(gcloud config get project)
    export RESERVATION_URL=RESERVATION_URL
    export REGION=REGION
    export CLUSTER_NAME=CLUSTER_NAME
    export HUGGING_FACE_TOKEN=YOUR_HF_TOKEN
    export NETWORK=YOUR_NETWORK_NAME
    export SUBNETWORK=YOUR_SUBNETWORK_NAME

Replace the following:

- `PROJECT_ID`: the ID of the Google Cloud project where you want to create the GKE cluster.

- `RESERVATION_URL`: the URL of the reservation that you want to use to create your GKE cluster. Based on the project in which the reservation exists, specify one of the following values:

  - The reservation exists in your project: `RESERVATION_NAME`

  - The reservation exists in a different project, and your project can use the reservation: `projects/RESERVATION_PROJECT_ID/reservations/RESERVATION_NAME`

- `REGION`: the region where you want to create your GKE cluster. You can only create the cluster in the region where you reservation exists.

- `CLUSTER_NAME`: the name of the GKE cluster to create.

- `YOUR_HF_TOKEN`: the Hugging Face access token that you created in the previous section.

- `YOUR_NETWORK_NAME`: the network that the GKE cluster uses. Specify one of the following values:

  - If you created a custom network, then specify the name of your network.

  - Otherwise, specify `default`.

- `YOUR_SUBNETWORK_NAME`: the subnetwork that the GKE cluster uses. Specify one of the following values:

  - If you created a custom subnetwork, then specify the name of your subnetwork. You can only specify a subnetwork that exists in the same region as the reservation.

  - Otherwise, specify `default`.

## Create and configure Google Cloud resources

Follow these instructions in this section to create the required resources.

> [!NOTE]
> **Note:** You might need to create a capacity reservation to make use of some accelerators. To learn how to reserve and consume reserved resources, see [Consuming reserved zonal resources](https://docs.cloud.google.com/kubernetes-engine/docs/how-to/consuming-reservations).

### Create a GKE cluster in Autopilot mode

To create a GKE cluster in Autopilot mode, run the following command:

    gcloud container clusters create-auto $CLUSTER_NAME \
        --project=$PROJECT_ID \
        --region=$REGION \
        --release-channel=rapid \
        --network=$NETWORK \
        --subnetwork=$SUBNETWORK

The creation of the GKE cluster might take some time to complete. To verify that Google Cloud has finished creating your cluster, go to [Kubernetes clusters](https://console.cloud.google.com/kubernetes/list/overview) on the Google Cloud console.

## Create a Kubernetes secret to store your Hugging Face credentials

To create a Kubernetes secret to store your Hugging Face credentials, do the following:

1. Configure `kubectl` to communicate with your GKE cluster:

       gcloud container clusters get-credentials $CLUSTER_NAME \
           --location=$REGION

2. Create a Kubernetes secret that contains the Hugging Face `read access` token that you created in an earlier step:

       kubectl create secret generic hf-secret \
           --from-literal=hf_token=${HUGGING_FACE_TOKEN} \
           --dry-run=client -o yaml | kubectl apply -f -

## Deploy a vLLM container to your GKE cluster

To deploy the vLLM container to serve the `deepseek-ai/DeepSeek-V3.2-Speciale` model, do the following:

1. Create a `vllm-deepseek3-2.yaml` file with your chosen vLLM deployment:

       apiVersion: apps/v1
       kind: Deployment
       metadata:
         name: deepseek3-2-deploy
       spec:
         replicas: 1
         selector:
           matchLabels:
             app: deepseek
         template:
           metadata:
             labels:
               app: deepseek
               ai.gke.io/model: deepseek-v3-2
               ai.gke.io/inference-server: vllm
               examples.ai.gke.io/source: user-guide
           spec:
             containers:
             - name: vllm-inference
               image: us-docker.pkg.dev/vertex-ai/vertex-vision-model-garden-dockers/pytorch-vllm-serve:model-garden.pytorch-vllm-serve-release_20251126.00_p0
               resources:
                 requests:
                   cpu: "10"
                   memory: "1000Gi"
                   ephemeral-storage: "1Ti"
                   nvidia.com/gpu: "8"
                 limits:
                   cpu: "10"
                   memory: "1000Gi"
                   ephemeral-storage: "1Ti"
                   nvidia.com/gpu: "8"
               command: ["python3", "-m", "vllm.entrypoints.openai.api_server"]
               args:
               - --model=$(MODEL_ID)
               - --tensor-parallel-size=8
               - --host=0.0.0.0
               - --port=8000
               - --max-model-len=131072
               - --max-num-seqs=16
               - --enable-chunked-prefill
               - --gpu-memory-utilization=0.90
               - --enforce-eager
               - --trust-remote-code
               env:
               - name: MODEL_ID
                 value: deepseek-ai/DeepSeek-V3.2-Speciale
               - name: HUGGING_FACE_HUB_TOKEN
                 valueFrom:
                   secretKeyRef:
                     name: hf-secret
                     key: hf_token
               volumeMounts:
               - mountPath: /dev/shm
                 name: dshm
               livenessProbe:
                 httpGet:
                   path: /health
                   port: 8000
                 initialDelaySeconds: 1800
                 periodSeconds: 10
               readinessProbe:
                 httpGet:
                   path: /health
                   port: 8000
                 initialDelaySeconds: 1800
                 periodSeconds: 5
             volumes:
             - name: dshm
               emptyDir:
                 medium: Memory
             nodeSelector:
               cloud.google.com/gke-accelerator: nvidia-b200
               cloud.google.com/reservation-name: $RESERVATION_URL
               cloud.google.com/reservation-affinity: "specific"
               cloud.google.com/gke-gpu-driver-version: latest

       ---
       apiVersion: v1
       kind: Service
       metadata:
         name: deepseek-service
       spec:
         selector:
           app: deepseek
         type: ClusterIP
         ports:
           - protocol: TCP
             port: 8000
             targetPort: 8000
       ---
       apiVersion: monitoring.googleapis.com/v1
       kind: PodMonitoring
       metadata:
         name: deepseek-monitoring
       spec:
         selector:
           matchLabels:
             app: deepseek
         endpoints:
         - port: 8000
           path: /metrics
           interval: 30s

2. Apply the `vllm-deepseek3-2.yaml` file to your GKE cluster:

         envsubst < vllm-deepseek3-2.yaml | kubectl apply -f -

   During the deployment process, the container must download the `deepseek-ai/DeepSeek-V3.2-Speciale` model from Hugging Face. For this reason, deployment of the container might take up to 30 minutes to complete.
3. To see the completion status, run the following command:

         kubectl wait \
             --for=condition=Available \
             --timeout=1800s deployment/deepseek3-2-deploy

   The`--timeout=1800s` flag allows the command to monitor the deployment for up to 30 minutes.

## Interact with DeepSeek-V3.2-Speciale by using curl

To verify the `DeepSeek-V3.2-Speciale` model that you deployed, do the following:

1. Set up port forwarding to DeepSeek-V3.2-Speciale:

       kubectl port-forward service/deepseek-service 8000:8000

2. Open a new terminal window. You can then chat with your model by using `curl`:

       time curl http://127.0.0.1:8000/v1/completions \
          -X POST \
          -H "Content-Type: application/json" \
          -d '{
            "model": "deepseek-ai/DeepSeek-V3.2-Speciale",
            "prompt": "<|im_start|>user\nExplain the ReAct (Reasoning + Acting) pattern in Agentic AI. Provide a concise Python pseudocode example showing the loop. Keep the explanation under 300 words.<|im_end|>\n<|im_start|>assistant\n",
            "max_tokens": 1024,
            "temperature": 0.7,
            "stream": false,
            "stop": ["<|im_end|>"]
          }'

3. The output that you see is similar to the following:

       {
       "id": "cmpl-be345f0499e949ed8500e533be2cfe3f",
       "object": "text_completion",
       "created": 1764803171,
       "model": "deepseek-ai/DeepSeek-V3.2-Speciale",
       "choices": [
         {
           "index": 0,
           "text": "The ReAct pattern integrates reasoning (thoughts) and actions (tool calls) within an agentic loop... [TRUNCATED FOR BREVITY] ...ReAct improves transparency and reliability by explicit reasoning steps.",
           "logprobs": null,
           "finish_reason": "stop",
           "stop_reason": "<|im_end|>",
           "token_ids": null,
           "prompt_logprobs": null,
           "prompt_token_ids": null
         }
       ],
       "service_tier": null,
       "system_fingerprint": null,
       "usage": {
         "prompt_tokens": 57,
         "total_tokens": 317,
         "completion_tokens": 260,
         "prompt_tokens_details": null
       },
       "kv_transfer_params": null
       }

## Observe model performance

To observe the performance of your model, you can use the vLLM dashboard integration in [Cloud Monitoring](https://docs.cloud.google.com/monitoring/docs/monitoring-overview). You can use this dashboard to view critical performance metrics like token throughput, request latency, and error rates.

For information about using Google Cloud Managed Service for Prometheus to collect metrics from your model, see the [vLLM](https://docs.cloud.google.com/stackdriver/docs/managed-prometheus/exporters/vllm) observability guidance in the Cloud Monitoring documentation.

## Clean up

To avoid incurring charges to your Google Cloud account for the resources used in this tutorial, either delete the project that contains the resources, or keep the project and delete the individual resources.

### Delete your project

> [!CAUTION]
> **Caution** : Deleting a project has the following effects:
>
> - **Everything in the project is deleted.** If you used an existing project for the tasks in this document, when you delete it, you also delete any other work you've done in the project.
> - **Custom project IDs are lost.** When you created this project, you might have created a custom project ID that you want to use in the future. To preserve the URLs that use the project ID, such as an `appspot.com` URL, delete selected resources inside the project instead of deleting the whole project.
>
> If you plan to explore multiple architectures, tutorials, or quickstarts, reusing projects can help you avoid exceeding project quota limits.

Delete a Google Cloud project:

```
gcloud projects delete PROJECT_ID
```

### Delete the resources

1. To delete the deployment and service in the `vllm-deepseek3-2.yaml` file and the Kubernetes secret from the GKE cluster, run the following command:

       kubectl delete -f vllm-deepseek3-2.yaml
       kubectl delete secret hf-secret

2. To delete your GKE cluster, run the following command:

       gcloud container clusters delete $CLUSTER_NAME \
               --region=$REGION

## What's next

- [Manage AI-optimized GKE clusters](https://docs.cloud.google.com/ai-hypercomputer/docs/manage/manage-gke-clusters)