All Products
Search
Document Center

Container Compute Service:Deploy a DeepSeek-R1 model inference service with ACS GPU

Last Updated:Nov 02, 2026

ACS provides serverless GPU compute with pay-as-you-go billing, eliminating GPU node management. Deploy a production-ready DeepSeek-R1 full model inference service on ACS with vLLM and remote direct memory access (RDMA) acceleration.

Background

DeepSeek-R1 model

DeepSeek-R1 is DeepSeek's first-generation reasoning model, trained with large-scale reinforcement learning to improve the reasoning ability of large language models (LLMs). Experiments show that DeepSeek-R1 outperforms other closed-source models and matches or exceeds OpenAI-O1 in tasks such as mathematical reasoning and programming competitions. DeepSeek-R1 also performs well in knowledge-based tasks and other task types, including creative writing and general Q&A. Explore the DeepSeek AI GitHub repository for details.

vLLM

vLLM is an efficient, easy-to-use LLM inference framework supporting popular models including Qwen. It accelerates inference through PagedAttention, continuous batching, and model quantization. Explore the vLLM GitHub repository for details.

ACS

ACS is a serverless, Kubernetes-based container service delivering general-purpose and heterogeneous compute, such as GPU compute, without node or cluster management. Integrated scheduling, container runtime, storage, and networking reduce operational complexity, while pay-as-you-go billing and elastic scaling lower costs. For LLM inference, ACS data and image acceleration further optimize model startup time and resource costs.

Prerequisites

Complete the following before you start:

  1. Create an ACS cluster with the default service role assigned.

  2. Configure kubectl to connect to your ACS cluster. See Obtain the cluster kubeconfig and connect to the cluster by using kubectl.

GPU instance specifications and cost estimation

Deploying the DeepSeek-R1 full model on ACS without acceleration consumes 16 GPU hours. Recommended single-instance configuration:

Resource

Specification

GPU

16 cards (96 GiB memory per card)

CPU

64 vCPU

Memory

512 GiB

For information about selecting instance specifications, see Recommended instance specifications and GPU instance types and specifications. For billing information, see Billing overview.

Note
  • ACS GPU instance specifications follow the ACS Pod specification logic.

  • ACS Pods include 30 GiB of free ephemeral storage by default. The inference image used in this topic requires more storage. If the default size does not meet your needs, you can increase the ephemeral storage size. For more information, see Increase the temporary storage space size.

Step 1: Prepare the DeepSeek-R1-GPTQ-INT8 model files

LLMs need substantial disk space. Use Network Attached Storage (NAS) or Object Storage Service (OSS) storage volumes for persistent model storage. The following steps use OSS as an example.

Note: Submit a ticket to obtain the model files and YAML deployment configuration.

  • Model files: DeepSeek-R1-GPTQ-INT8

  • GPU model: Replace the label alibabacloud.com/gpu-model-series with the actual GPU model supported by ACS. For more information, see Specify GPU models and driver versions for ACS GPU-accelerated pods.

  • Base image: Replace containers[].image with the actual image address.

  • Image pull secret: Create a Secret, and replace imagePullSecrets[].name with the actual Secret name.

(Optional) Upload the model to OSS

If you downloaded the model files locally, create a directory in OSS and upload the model:

ossutil mkdir oss://<your-bucket-name>/models/DeepSeek-R1-GPTQ-INT8
ossutil cp -r /mnt/models/DeepSeek-R1-GPTQ-INT8 oss://<your-bucket-name>/models/DeepSeek-R1-GPTQ-INT8

For information about installing and using ossutil, see Install ossutil.

Create a PV and PVC

Create a PersistentVolume (PV) and PersistentVolumeClaim (PVC) named llm-model for your cluster. For more information, see Use an ossfs 1.0 static volume.

Console

Configure the PV with the following settings:

Parameter

Value

Storage Volume Type

OSS

Name

llm-model

Access Credentials

AccessKey ID and AccessKey Secret for OSS access

Bucket ID

Select your OSS bucket

OSS Path

/models/DeepSeek-R1-GPTQ-INT8

Configure the PVC with the following settings:

Parameter

Value

Storage Claim Type

OSS

Name

llm-model

Allocation Mode

Existing Storage Volume

Existing Storage Volume

Select the PV you created

kubectl

apiVersion: v1
kind: Secret
metadata:
  name: oss-secret
stringData:
  akId: <your-oss-ak> # The AccessKey ID that is used to access OSS
  akSecret: <your-oss-sk> # The AccessKey Secret that is used to access OSS
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: llm-model
  labels:
    alicloud-pvname: llm-model
spec:
  capacity:
    storage: 30Gi
  accessModes:
    - ReadOnlyMany
  persistentVolumeReclaimPolicy: Retain
  csi:
    driver: ossplugin.csi.alibabacloud.com
    volumeHandle: llm-model
    nodePublishSecretRef:
      name: oss-secret
      namespace: default
    volumeAttributes:
      bucket: <your-bucket-name> # The name of the OSS bucket
      url: <your-bucket-endpoint> # The endpoint of the bucket, such as oss-cn-hangzhou-internal.aliyuncs.com
      otherOpts: "-o umask=022 -o max_stat_cache_size=0 -o allow_other"
      path: <your-model-path> # The path in which the model is stored, which is /models/DeepSeek-R1-GPTQ-INT8/ in this example
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: llm-model
spec:
  accessModes:
    - ReadOnlyMany
  resources:
    requests:
      storage: 30Gi
  selector:
    matchLabels:
      alicloud-pvname: llm-model

Step 2: Deploy the model using ACS GPU

Deploy the DeepSeek-R1-GPTQ-INT8 inference service using vLLM with RDMA acceleration. The service exposes an OpenAI-compatible API. The following YAML file treats the model parameter files as a special type of data set and mounts them to the specified path (/data/DeepSeek-R1-GPTQ-INT8) in the inference container.

Note:

  • The --max-model-len parameter controls the maximum token length. Higher values improve conversation quality but require more GPU memory. For DeepSeek-R1-GPTQ-INT8, the recommended maximum is around 128,000 tokens. You must adjust --max-model-len together with --gpu-memory-utilization.

  • RDMA provides zero-copy and kernel-bypass networking, which avoids data copying and frequent context switches, resulting in lower latency, higher throughput, and lower CPU usage compared with TCP/IP. Add the label alibabacloud.com/hpn-type: "rdma" in the YAML file to enable RDMA. For more information, see Run applications using high-performance RDMA networks. Submit a ticket to query the GPU models that support RDMA.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: deepseek-r1
  namespace: default
  labels:
    app: deepseek-r1
spec:
  replicas: 1
  selector:
    matchLabels:
      app: deepseek-r1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
  template:
    metadata:
      labels:
        app: deepseek-r1
        alibabacloud.com/compute-class: gpu
        alibabacloud.com/gpu-model-series: <example-model>
        alibabacloud.com/hpn-type: "rdma"
    spec:
      imagePullSecrets:
        - name: <your-secret-name>
      containers:
        - name: llm-ds-r1
          image: <your-image-address>
          imagePullPolicy: IfNotPresent
          command:
            - sh
            - -c
            - "vllm serve /data/DeepSeek-R1-GPTQ-INT8 --port 8000 --trust-remote-code --served-model-name ds --max-model-len 128000 --quantization moe_wna16 --gpu-memory-utilization 0.98 --tensor-parallel-size 16"
          resources:
            limits:
              alibabacloud.com/gpu: "16"
              cpu: "64"
              memory: 512Gi
            requests:
              alibabacloud.com/gpu: "16"
              cpu: "64"
              memory: 512Gi
          volumeMounts:
            - name: llm-model
              mountPath: /data/DeepSeek-R1-GPTQ-INT8
            - name: shm
              mountPath: /dev/shm
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      volumes:
        - name: llm-model
          persistentVolumeClaim:
            claimName: llm-model
        - name: shm
          emptyDir:
            medium: Memory
            sizeLimit: 32Gi
---
apiVersion: v1
kind: Service
metadata:
  name: deepseek-r1
spec:
  type: ClusterIP
  selector:
    app: deepseek-r1
  ports:
    - protocol: TCP
      port: 8000
      targetPort: 8000

Apply the configuration:

kubectl apply -f deepseek-r1-deployment.yaml

Step 3: Verify the inference service

  1. Set up port forwarding to the inference service:

    kubectl port-forward svc/deepseek-r1 8000:8000

    Expected output:

    Forwarding from 127.0.0.1:8000 -> 8000
    Forwarding from [::1]:8000 -> 8000

    Important: kubectl port forwarding suits development and debugging only. It does not provide production-level reliability, security, or scalability. For more information about production-grade networking options for Kubernetes clusters, see Ingress management.

  2. Send a test inference request:

    curl http://localhost:8000/v1/chat/completions \
      -H "Content-Type: application/json" \
      -d '{
        "model": "ds",
        "messages": [
          {
            "role": "user",
            "content": "Explain the concept of reinforcement learning in simple terms."
          }
        ],
        "max_tokens": 1024,
        "temperature": 0.7,
        "top_p": 0.9,
        "seed": 10
      }'

    A successful response confirms the service is running.

(Optional) Step 4: Clean up resources

If you no longer need the model inference service that you deployed by following this topic, release the resources at the earliest opportunity to avoid unnecessary fees.

  1. Delete the model inference workload and service:

    kubectl delete deployment deepseek-r1
    kubectl delete service deepseek-r1
  2. Delete the PV and PVC:

    kubectl delete pvc llm-model
    kubectl delete pv llm-model

    Expected output:

    persistentvolumeclaim "llm-model" deleted
    persistentvolume "llm-model" deleted

Result

You have deployed a DeepSeek-R1 full model inference service on ACS with GPU acceleration. The service exposes an OpenAI-compatible API ready for application integration.