You need to enable JavaScript to run this app.
Volcengine Kubernetes Engine

Volcengine Kubernetes Engine

Copy page
Download PDF
Deepseek practices
Quickly deploying DeepSeek-R1 (full version) with SGLang
Copy page
Download PDF
Quickly deploying DeepSeek-R1 (full version) with SGLang
The following content introduces how to quickly deploy a model inference service with the full-version DeepSeek-R1 based on SGLang by using Volcengine Kubernetes Engine (VKE).​
Solution introduction​
This solution provides a quick method of deploying DeepSeek-R1 LLM in a Kubernetes cluster that integrates a series of acceleration technologies that come with the Volcano Engine:​
  • DeepSeek-R1 model: released by Chinese AI startup DeepSeek, the R1 model is an inference model trained based on DeepSeek-V3-Base, excelling in mathematics, code, and natural language reasoning, gaining wide attention for its open source, algorithm innovation, and cost-effectiveness.​
  • GDKV model acceleration: a fast model loading solution achieved through the Remote Direct Memory Access (RDMA) and GPU Direct RDMA (GDR) technologies provided by Volcano Engine.​
  • Elastic Instant Cache (EIC): a high-performance distributed KV Cache service launched by the Volcano Engine storage team for LLM inference.​
Advantages of the solution:​
  • Rapid model loading: Multiple acceleration technologies are used to reduce the loading time of the DeepSeek-R1 model to 13 seconds, with a loading speed increased by more than 40 times.​
  • Cache pooling: breaks through the single-machine memory wall limit by integrating idle memory and disks of GPU clusters to build a distributed cache pool.​
Deployment information​
  • Model: DeepSeek-R1-671B​
  • Inference engine: SGLang​
  • Instance specification: ecs.hpcpni3ln.45xlarge instance* 2​
Capabilities​
  • Precision: FP8​
  • Model acceleration: GDKV​
  • KV Cache: EIC​
  • Monitoring: Volcengine Managed Service for Prometheus (VMP) and Application Performance Management Plus (APMPlus)​
  • Access: API Gateway (APIG)​
Notes​
  • To ensure successful deployment, which involves a bunch of add-ons dependent on each other and a variety of configurations, you need to exactly follow the instructions in this document.​
  • If both GDKV model acceleration and EIC are enabled, the memory on the node where instances are running may become a performance bottleneck. To avoid that, we recommend enabling EIC only. For details, see Method for testing EIC performance.​
  • To avoid violation of the VKE limit, we recommend that you proceed based on this solution (or on the resources mentioned in the documents). If you need to change your solution, you can consult the Account Manager of the Volcano Engine.​
  • Do not use mGPU on GPU resources.​
  • A full deployment depends on some beta capabilities of the Volcano Engine. Contact the Account Manager of the Volcano Engine to apply for the beta trial of the following features:​
  • ​
    Beta feature/resource​
    Product involved​
    Description​
    hpcpni3ln instance optimized for High-Performance Computing based on GPU ​
    The HPC instance, providing computing power. The DeepSeek model has a large number of parameters and therefore requires a GPU instance with large memory, e.g., ecs.hpcpni3ln.45xlarge.​
    Capability of mounting nodes to local disks​
    You can configure the local disk mounting in the VKE cluster.​
    EIC​
    EIC​
    A high-performance distributed KV Cache service launched by the Volcano Engine storage team for LLM inference.​
    ​
Prerequisites​
Create a High-Performance Compute Cluster​
The high-performance compute cluster is used to achieve logical isolation of HPC GPU instances (compute nodes). Instances in the same cluster are interconnected by Remote Direct Memory Access (RDMA) networks. For details, see Creating HPC clusters.​
tip​
The region and availability zone where the high-performance compute cluster is located need to be consistent with the region and availability zone of the VKE nodes.​
Creating a VKE cluster​
The following parameters need to be configured as described in the table when creating a cluster by using the VKE. For details on other parameters, see Creating clusters.​
​
Configuration item​
Description​
Cluster configuration​
​
Kubernetes version​
Select version v1.28 or later.​
Network model​
Select VPC-CNI.​
Node pool configuration​
​
Managed node pool​
Enable Managed node pool.​
Availability zone​
Same availability zone as the High-Performance Compute Cluster.​
Instance type​
Select ecs.hpcpni3ln, the GPU Accelerated specification. Ensure you already obtained permission for trial of the beta version.​
High Performance Computing Cluster​
Select the HPC cluster you created.​
Number of nodes​
2 nodes.​
Data volume​
Configure the following two data volumes:​
  • ESSD: set capacity to 1024 GiB and the performance level to the default PL0.​
  • Local SSD: Specify /data01 as the mount directory.​
warning​
  • The data01 directory has subsequent dependencies. Therefore, the directory cannot be modified or specified.​
  • Ensure the data that needs long-term storage has been backed up properly in case of computer crashes or disk damage which causes data loss.​
Node labels​
When you deploy the DeepSeek model by using VKE, you need to specify the RDMA usage mode by using node labels.​
Set the label key to vke.node.rdma.mode and the label value to shared.​
Kubelet configs​
The non-uniform memory access (NUMA) affinity policy for RDMA devices needs to be configured by using custom parameters with the Kubelet when deploying DeepSeek model in the VKE.​
Select the parameter topology-manager-policy and its value best-effort.​
Addon configuration​
​
nvidia-device-plugin​
(Required) The NVIDIA device driver. It allows use of management add-ons for GPUs in containers.​
rdma-device-plugin​
(Required) The add-on manages RDMA network interface cards (NICs) and enables pod containers to use RDMA devices.​
apig-controller​
(Required) API Gateway controller provides the AI Gateway capability of cloud-native, which can complete the intelligent load balancing of the inference traffic according to different policies.​
csi-ebs​
(Required) It allows VKE clusters to use the standard Container Storage Interface (CSI) of TOS.​
prometheus-agent​
(Required) Volcengine Managed Service for Prometheus (VMP) monitoring add-on collects the monitoring metrics data of the Kubernetes cluster to VMP.​
apmplus-opentelemetry-collector​
(Required) Collect OpenTelemetry data and Prometheus metrics, and send them to Application Performance Management Plus (APMPlus).​
apmplus-server-agent​
(Required) Send the collection service and host monitoring data to APMPlus in parallel.​
cr-credential-controller​
(Recommended) It can pull Container Registry (CR) images without passwords, which simplifies deployment operations.​
keda​
(Recommended) The event-driven autoscaler based on Kubernetes completes the autoscaler tasks of the inference service based on complex metrics.​
vci-virtual-kubelet​
(Recommended) It can deploy CPU-consuming workloads such as system add-ons by using Volcengine Container Instance (VCI), which eliminates the need for operation and maintenance (O&M) and does not occupy the computing resources of GPU nodes.​
​
Procedure​
Step 1: Create an EIC instance​
With approaches such as storage-instead-of-computation and zero-copy GDR, EIC significantly reduces GPU resource consumption and inference latency.​
  1. Log in to the EIC console.​
  1. Click Instances in the left navigation bar and click Create instance.​
  1. Configure parameters required on the page. The parameters mentioned below need to be configured as described. Other parameters can be configured as needed.​
  • ​
    Configuration item​
    Description​
    VKE cluster​
    Select the created VKE cluster.​
    Storage type​
    Select DRAM.​
    Enable RDMA​
    Enable RDMA.​
    Node​
    Select the nodes created during VKE cluster creation.​
    DRAM​
    Set to 500 GiB.​
    Network interface card​
    Set to eth1, eth2, eth3, eth4.​
    ​
  1. Click Create instance in the lower-right corner of the page. If Running is displayed in the Status column, it indicates that the EIC instance has been created.​
  • If an error occurs when creating an instance, the status will change to Failed. You can hover the mouse over the instance status to view the details. You can delete the instance that fails to be created by clicking Delete in the Actions column and then create a new one. If you cannot handle the issue, contact your account manager of Volcano Engine for support.​
Step 2: Deploy LeaderWorkerSet​
In this topic, LeaderWorkerSet (LWS) is used to orchestrate the inference workloads across multiple nodes (for example, DeepSeek R1 needs to be deployed across two nodes). LWS allows you to specify a group of pods as objects to be replicated.​
  1. Log in to the VKE console.​
  1. In the left navigation bar, click Application center > Application template. Scroll to the bottom of the page, click More application templates.​
  1. Find leader-worker-set, move the pointer over it, and then click Deploy.​
  1. On the Deploy application page, configure the parameters for leader-worker-set.​
  • ​
    Configuration item​
    Descriptio​
    Orchestration template​
    ​
    Application template​
    Select the latest Chart version of leader-worker-set.​
    Name​
    Customize the application name according to the naming requirements prompted by the interface.​
    Deployment environment​
    ​
    Cluster type​
    Keep the default value as Managed version.​
    Cluster​
    Select the VKE cluster created in Prerequisites.​
    Namespace​
    Select a namespace under the target cluster.​
    Protocol​
    Read and understand the agreement before selecting it. ​
    ​
  1. Click Confirm to start deployment.​
  • The applications that are already deployed can be found on the Helm page. Find leader-worker-set application by specifying target project, cluster, and namespace, and then click it to view detailed information of the application.​
Step 3: Deploy deepseek-r1-sglang​
VKE allows DeepSeek-R1 model based applications to run with PD (Prefill-Decode) disaggregation on the SGLang framework, which can be quickly realized by using the Application template.​
  1. In the left navigation bar of the VKE console, click Application center > Application template.​
  1. On the Application template page, find deepseek-r1-sglang and click Deploy.​
  1. On the Deploy application page, configure the parameters for deepseek-r1-sglang.​
  • ​
    Configuration item​
    Description​
    Orchestration template​
    ​
    Application template​
    Select the latest Chart version of deepseek-r1-sglang.​
    Parameter configuration​
    Select the configuration method for deepseek-r1-sglang. If you need to enable EIC, click the edit icon to modify the values.yaml file based on the EIC-related parameters in the YAML file section below the table.​
    Name​
    Customize the application name according to the naming requirements prompted by the interface.​
    Deployment environment​
    ​
    Cluster​
    Select the VKE cluster created in Prerequisites.​
    Namespace​
    Select a namespace under the target cluster.​
    Protocol​
    Read and understand the agreement before selecting it.​
    ​
  • EIC-related parameters in the YAML file:​
  • ​
    eic:​
    enabled: true​
    # EIC Instance ID. Log in to the EIC console and click the EIC instance to find the endpoint on the "Instance Information" tab.​
    instanceID: "eicydx97nk******" ​
    # Endpoint of the EIC instance. Log in to the EIC console and click the EIC instance to find the endpoint on the "Instance Information" tab.​
    remoteURL: "eic://192.168.xx.xx:12500;192.168.xx.xx:12500;192.168.xx.xx:12500"​
    # EIC node network interface card. Log in to the EIC console and click the EIC instance to find the NIC on the "Node List" tab.​
    netLocalInterfaceNames: "eth1;eth2;eth3;eth4"​
    # Deploy the ID of the VKE node pool corresponding to the EIC node. Log in to the VKE console. In the left navigation bar of the cluster management page, click Nodes > Node pool to view the ID.​
    machinePool: "pd0ve352******"​
    ​
  1. Click Confirm to deploy the application.​
  • The applications that are already deployed can be found on the Helm page. Find deepseek-r1-sglang application by specifying target project, cluster, and namespace, then click it to view detailed information of the application.​
tip​
The service names that match the pattern <application name>-api-svc indicate those services will be working as the external access points of their applications, and therefore are supposed to be used when configuring routing and verifying model deployment.​
  1. View the load status of deepseek-r1-sglang applications on the Deployment page of the VKE cluster.​
  1. On the left navigation bar of the VKE console, select Cluster, and find the target cluster and click the cluster name.​
  1. In the left navigation bar, select Workload > StatefulSet, then enter the name deepseek-r1-sglang in the search box to find it and view its status.​
Step 4: Configure Ingress​
Configure model routing through APIG Ingress. APIG Ingress can function as a managed cloud-native gateway based on the Volcano Engine APIG, realizing high availability and scalability in Ingress traffic management that are required in cloud-native applications.​
  1. On the left navigation bar on the cluster management page, select Services and Ingresses > Ingress, and click Create Ingress. Use API Gateway to expose the model service externally in the cluster. The parameters mentioned below need to be configured as described. Other parameters can be configured by referring to the Creating APIG Ingress through the console.​
  • ​
    Configuration item​
    Description​
    Basic configuration​
    ​
    Namespace​
    Select the namespace in which the deepseek-r1-sglang application template is deployed. It is used to associate the service that is supposed to be exposed for its application.​
    Ingress configuration​
    ​
    Ingress type​
    Select Cloud-native API gateway.​
    APIG specification settings​
    ​
    Gateway specifications​
    You can select Automatically create, or select Use existing APIG instances.​
    tip​
    When you are using the API Gateway to expose the model service in the clusters, we recommend you to configure the following parameters or features (Some parameters can only be configured in the APIG console, and cannot be configured in the VKE console):​
    • Instance specification: We recommend that you select 4c8g, with two availability zones to realize high availability by default.​
    • Bandwidth limit: This option is used to set the maximum bandwidth of the Classic Load Balancer (CLB) instance working with the APIG instance. If more bandwidth is required, you can specify a custom CLB instance on the APIG console. For details, see Adding access entrance.​
    • Circuit breaking: When some GPU instances malfunction, common practice is to take the faulty instances offline to eliminate failures. At the same time, it is necessary to retain the faulty instances for troubleshooting later. You can isolate the faulty instances by configuring a circuit breaking rule for the APIG instance.​
    • Request timeout: Timeout is not applied to API Gateway by default. We recommend that you keep the default settings. If timeout is needed, you can configure it on the API Gateway console. For details, refer to Advanced routing policy.​
    • Observability: Monitoring alert and log feature are not turned on by default for the API Gateway instances created in the VKE console. If needed, we recommend that you enable logging and monitoring/alerting for the instance in the APIG console.​
    • Instance monitoring: This can help you to detect the unexpected anomalies in the whole system chain from the gateway entry level. For example: Unhealthy back end and back-end crashes will cause the APIG to return 503 error code and specific errors.​
    • Instance logs: You can view the request errors, request time consumption, and the allocation of requests in various Pods in the back end from the access logs.​
    Backend upstream​
    We recommend that you set the Load balancing algorithm parameter to Round Robin. It is more applicable to the scenarios of upgrading back-ends if the back-end loads are approximately balanced.​
    Listener configuration​
    ​
    Protocol​
    Select a protocol as needed. If HTTPS is selected, you need to configure the certificate as described in the document APIG Ingress.​
    Forwarding configuration​
    ​
    Domain name​
    Fill in the Ingress domain name to be exposed. The A (Address) record of this domain name needs to be configured later with the public or private IP address generated when the Ingress is successfully created.​
    Service​
    Select the service that is named in the pattern <application name>-api-svc and is associated with the application created based on deepseek-r1-sglang template, and then set the port number to 8080.​
    ​
  1. (Optional) Configure authentication for an APIG.​
  1. Log in to the API Gateway console.​
  1. Create consumer: Click Consumer management in the left navigation bar and click Create consumers.​
  1. Generate an API-KEY: In the consumer list, click the name of the target consumer to enter the consumer details page. In the API Key information area, click Generate API Key.​
  1. In the pop-up dialog box, select Automatically create. ​
  1. Click Confirm to generate API Key credential information.​
  1. Enable Key Auth add-on: In the left navigation bar, click Plugin Center. On the page that appears, select Key Auth and then click Create Plugin.​
  1. Effective level: Select Routing level and configure the instance, Service, and route to which the add-on belongs.​
  1. Authentication configuration: Select header and enter the text "Authorization" in the textbox on the right side to indicate that API Key will be included in the Authorization header of requests.​
  1. Consumer: select the consumer created in step 1.​
  1. Other options can remain as default.​
  1. Obtain Ingress address.​
  • VIP: includes both public and private IP.​
  • Backend service: includes the backend service name and access domain name.​
  1. Configure domain name resolution.​
  • To test the DNS in the local environment, you can implement a domain-to-IP resolution locally.​
  • In the production environment, configure the access domain name of Ingress among the domain name providers, and ensure the A record of the Ingress access domain name has been configured with the public IP address or private IP address of Ingress.​
Step 5: Enable observability​
Basic observability provides the monitoring metrics for AI resources and inference service. Deep observability provides full-link performance monitoring service for inference application.​
Basic observability​
  1. In the left navigation bar of the page for a specific cluster, select Overview under the gray title Cloud native observability, then click Enable on the page to start monitoring. For more configuration details, refer to Enable observability and VKE observability.​
  1. After turning on observability, the application metrics of SGLang will be collected into the Volcengine Managed Service for Prometheus (VMP). You can use Explore to query metrics in the VMP console. An example is as follows:​
  • There is a built-in VMP dashboard that allows you to view the metrics collected from SGLang-based applications. To do that, you can go to the VMP console, select Monitoring dashboard in the left navigation bar and search for sglang to open dashboard as shown below:​
  • ​alt​​
  1. Log in to the above Grafana and select to import the following dashboard JSON file:​
  • ​
    ​
    SGLang Dashboard-1747206543364.json
    ​
    ​
  1. The effect after import is shown in the figure:​
  • ​​​
  • ​​​
Deep observability​
  1. Log in to the APMPlus console. In the left navigation bar, click Server-side monitoring.​
  1. Search for sglang and click the service name in the results to open the monitoring dashboard page.​
  1. View metrics.​
  • LLM metrics​
  • On tabs such as Service Overview, LLM performance, and Token usage, you can view the core metrics of the LLM service, including number of LLM calls, token usage, response latency, TTFT, TPOT, QPS, and request error rate.​
tip​
TTFT and TPOT are effective only when LLMs are called with streaming-enabled requests.​
  • The example of streaming call is as follows:​
  • ​
    curl localhost:8080/v1/chat/completions \​
    -H "Content-Type: application/json" \​
    -d '{​
    "model": "/data/models/DeepSeek-R1",​
    "messages": [​
    {​
    "role": "user",​
    "content": "hello"​
    }​
    ],​
    "stream": true,​
    "stream_options": {​
    "include_usage": true,​
    "continuous_usage_stats": true​
    }​
    }'​
    ​
  • Runtime metrics​
  • On the Runtime monitoring tab, you can view runtime-related metrics, including CPU time, CPU usage, memory usage, number of GC objects, thread count, and context switch count.​
  1. View link analysis.​
  • From the Trace analysis tab of the SGLang application, you can retrieve link information based on different conditions. Click the ID of the target trace to go to the details page of the trace. View the trace information in the list.​
Model verification​
Method 1: Access through Service​
The service, created along with the deployment of deepseek-r1-sglang application, has a name matching the pattern <application name>-api-svc. You can use the endpoint address (port 8080) corresponding to that service name to perform tests in this method. The endpoint can be called as you do with OpenAI APIs.​
The sample code is as follows.​
tip​
  • Replace ****** in http://****** with the endpoint of your <application name>-api-svc Service.​
  • The parameter content specifies the text you input to chat with LLMs.​
​
curl http://******/v1/chat/completions \​
-H "Content-Type: application/json" \​
-d '{​
"model": "/data/models/DeepSeek-R1",​
"messages": [​
{​
"role": "user",​
"content": "Who are you?"​
}​
]​
}'​
​
Alternatively, you can directly log in to the pod to perform API calls. To do that, you can go to the Helm application details page of deepseek-r1-sglang application, click the associated StatefulSet in the section Workload, and then in the new page, click Console in the top-right corner to open the console where commands can be executed.​
​alt​​
Method 2: Access via APIG​
When enabling the authentication feature of the APIG, you need to add an authentication token in the request.​
The following example is provided for reference.​
tip​
  • Replace the example.com in http://example.com with the domain name of the back-end services obtained in Step 4: Configure Ingress.​
  • Replace eyJhbGciOiJSUzI****** with the API Key generated in Step 4: Configure Ingress.​
  • The parameter content is what you want to type to chat with LLMs.​
​
curl http://example.com/v1/chat/completions -X POST \​
-H "Content-Type: application/json" \​
-H "Authorization: Bearer eyJhbGciOiJSUzI******" \​
-d '{​
"model": "/data/models/DeepSeek-R1-W4AFP8",​
"messages": [​
{"role": "system", "content": "You are a helpful assistant."},​
{"role": "user", "content": "Who won the world series in 2020?"}​
]​
}'​
​
​
Last updated: 2026.07.24 15:50:48