All Products
Search
Document Center

Container Service for Kubernetes:Deploy a vLLM model as an inference service

Last Updated:Aug 27, 2026

vLLM is an inference library for large language models that supports multiple model formats and backend accelerators, which makes it suitable for serving large-scale language models. In this tutorial, you use the Qwen-7B-Chat-Int8 model on V100 GPUs to build an inference service that you can query over HTTP.

For more information about vLLM, see vllm-project.

Prerequisites

Step 1: Prepare the model data and configure a persistent volume

You can prepare the model data in OSS or in NAS. For more information, see Use an ossfs 1.0 static volume and Use static NAS volumes. This tutorial uses OSS.

Download the model to your local machine

This tutorial uses the Qwen-7B-Chat-Int8 model.

  1. Run the following command to install Git:

    sudo yum install git
  2. Run the following command to install the Git LFS (Large File Storage) plugin:

    sudo yum install git-lfs
  3. Run the following command to clone the Qwen-7B-Chat-Int8 repository from ModelScope to your local machine:

    GIT_LFS_SKIP_SMUDGE=1 git clone https://www.modelscope.cn/qwen/Qwen-7B-Chat-Int8.git
  4. Run the following command to go to the Qwen-7B-Chat-Int8 repository directory:

    cd Qwen-7B-Chat-Int8
  5. Run the following command in the Qwen-7B-Chat-Int8 directory to download the large files that are managed by LFS:

    git lfs pull
Upload the model files to OSS
  1. Log on to the OSS console and record the name of the bucket that you created. For more information about how to create a bucket, see Create a bucket.

  2. Install and configure ossutil. For more information, see Install ossutil.

  3. Run the following command to create a directory named Qwen-7B-Chat-Int8 in OSS:

    ossutil mkdir oss://<Your-Bucket-Name>/Qwen-7B-Chat-Int8
  4. Run the following command to upload the model files to OSS:

    ossutil cp -r ./Qwen-7B-Chat-Int8 oss://<Your-Bucket-Name>/Qwen-7B-Chat-Int8
Configure a PV and a PVC

Configure a persistent volume (PV) and a persistent volume claim (PVC) named llm-model for the destination cluster. For more information, see Use an ossfs 1.0 static volume.

  • PV basic configurations:

    Configuration item

    Description

    PV Type

    OSS

    Volume Name:

    llm-model

    Access Certificate

    Configure the AccessKey ID and AccessKey secret that are used to access OSS.

    Bucket ID:

    Select the OSS bucket you created in Upload the model files to OSS.

    OSS Path

    Select the path in which the model is stored, such as /Qwen-7B-Chat-Int8.

  • PVC basic configurations:

    Configuration item

    Description

    PVC Type

    OSS

    Name

    llm-model

    Allocation Mode

    Select Existing Volumes.

    Existing Volumes

    Click Select PV and select the PV that you created.

Step 2: Deploy the inference service

In this step, you check the available GPU resources and then start the vLLM inference service.

  1. Run the following command to check the GPU resources that are available in the cluster:

    arena top node
  2. Run the following command to start the vllm inference service:

    arena serve kserve \
        --name=qwen \
        --image=kube-ai-registry.cn-shanghai.cr.aliyuncs.com/kube-ai/vllm:0.4.1 \
        --gpus=1 \
        --cpu=4 \
        --memory=12Gi \
        --data="llm-model:/mnt/models/Qwen-7B-Chat-Int8" \
        "python3 -m vllm.entrypoints.openai.api_server --port 8080 --trust-remote-code --served-model-name qwen --model /mnt/models/Qwen-7B-Chat-Int8 --gpu-memory-utilization 0.95 --quantization gptq --max-model-len=6144"

    Parameter

    Required

    Description

    --name

    Yes

    The name of the submitted inference service. The name must be globally unique.

    --image

    Yes

    The image address of the inference service.

    --gpus

    No

    The number of GPUs that the inference service uses. Default value: 0.

    --cpu

    No

    The number of CPUs that the inference service uses.

    --memory

    No

    The amount of memory that the inference service uses.

    --data

    No

    The model address of the service. In this topic, the model is stored in llm-model, which is mounted to the /mnt/models/ directory in the container.

    Expected output:

    inferenceservice.serving.kserve.io/qwen created
    INFO[0006] The Job qwen has been submitted successfully 
    INFO[0006] You can run `arena serve get qwen --type kserve -n default` to check the job status

Step 3: Verify the inference service

In this step, you confirm the deployment status and send a test request to the inference service.

  1. Run the following command to query the deployment status of the KServe inference service:

    arena serve get qwen

    Expected output:

    Click to view the deployment status of the inference service

    Name:       qwen
    Namespace:  default
    Type:       KServe
    Version:    1
    Desired:    1
    Available:  1
    Age:        2m
    Address:    http://qwen-default.example.com
    Port:       :80
    GPU:        1
    
    
    Instances:
      NAME                             STATUS   AGE  READY  RESTARTS  GPU  NODE
      ----                             ------   ---  -----  --------  ---  ----
      qwen-predictor-5485d6d8d5-kvj7g  Running  2m   1/1    0         1    cn-beijing.XX.XX.XX.XX

    The output indicates that the KServe inference is deployed at http://qwen-default.example.com.

  2. Run the following command to access the inference service through the Nginx Ingress gateway:

    # Obtain the IP address of the Nginx Ingress.
    NGINX_INGRESS_IP=$(kubectl -n kube-system get svc nginx-ingress-lb -ojsonpath='{.status.loadBalancer.ingress[0].ip}')
    # Obtain the hostname of the inference service.
    SERVICE_HOSTNAME=$(kubectl get inferenceservice qwen -o jsonpath='{.status.url}' | cut -d "/" -f 3)
    # Send a request to access the inference service.
    curl -H "Host: $SERVICE_HOSTNAME" -H "Content-Type: application/json" http://$NGINX_INGRESS_IP:80/v1/chat/completions -d '{"model": "qwen", "messages": [{"role": "user", "content": "Run a test"}], "max_tokens": 10, "temperature": 0.7, "top_p": 0.9, "seed": 10}'

    Expected output:

    Click to view the expected output

    {"id":"cmpl-b7579597aa284f118718b22b83b726f8","object":"chat.completion","created":1715589652,"model":"qwen","choices":[{"index":0,"message":{"role":"assistant","content":"好的,请问您有什么需要测试的?<|im_end|>"},"logprobs":null,"finish_reason":"length","stop_reason":null}],"usage":{"prompt_tokens":10,"total_tokens":20,"completion_tokens":10}}% 

    The output indicates that the request was sent to the service, and an expected JSON response was returned.

(Optional) Step 4: Delete the inference service

Important

Before deleting the service, make sure that you no longer need the service and its related resources.

Run the following command to delete the inference service:

arena serve delete qwen

References