Chapter 1. Deploying models by using Distributed Inference with llm-d
Distributed Inference with llm-d is a Kubernetes-native, open-source framework designed for serving large language models (LLMs) at scale. You can use Distributed Inference with llm-d to simplify the deployment of generative AI, focusing on high performance and cost-effectiveness across various hardware accelerators.
Key features of Distributed Inference with llm-d include:
- Efficiently handles large models using optimizations such as prefix-cache aware routing and disaggregated serving.
- Integrates into a standard Kubernetes environment, where it leverages specialized components like the Envoy proxy to handle networking and routing, and high-performance libraries such as vLLM and NVIDIA Inference Transfer Library (NIXL).
- Tested recipes and well-known presets reduce the complexity of deploying inference at scale, so users can focus on building applications rather than managing infrastructure.
1.1. Enabling Distributed Inference with llm-d Copy linkLink copied to clipboard!
This procedure describes how to create a custom resource (CR) for an LLMInferenceService resource. You replace the default InferenceService with the LLMInferenceService.
Prerequisites
- You have enabled the model serving platform.
- You have access to an OpenShift cluster running version 4.19.9 or later.
- OpenShift Service Mesh v2 is not installed in the cluster.
Verify that you have a
GatewayClassand aGatewaynamedopenshift-ai-inferencein theopenshift-ingressnamespace as described in Gateway API with OpenShift Container Platform networking.ImportantReview the Gateway API deployment topologies. Only use shared Gateways across trusted namespaces.
If you are running OpenShift on a bare-metal cluster, your cluster administrator has an external entry point for the
openshift-ai-inferenceGateway service.NoteBy default, the Inference Gateway uses type:
LoadBalancer. If the cluster does not already include support forLoadBalancerservices, you can use the OpenShift option described in Load balancing with MetalLB.-
Optional: Your cluster administrator has installed the
LeaderWorkerSetOperator in OpenShift. This is an optional dependency because it is only a requirement for inference deployments where a single server has any from of parallelism (tensor, pipeline, data) that is more than 8 accelerators and so is classified as multi-node. For more information, see the Leader Worker Set Operator documentation. - You have enabled authentication as described in Configuring authentication for Distributed Inference with llm-d.
Procedure
- Log in to the OpenShift console as a developer.
Create the
LLMInferenceServiceCR with the following information:apiVersion: serving.kserve.io/v1alpha1 kind: LLMInferenceService metadata: name: sample-llm-inference-service spec: replicas: 2 model: uri: hf://RedHatAI/Qwen3-8B-FP8-dynamic name: RedHatAI/Qwen3-8B-FP8-dynamic router: route: {} gateway: {} scheduler: {} template: containers: - name: main resources: limits: cpu: '4' memory: 32Gi nvidia.com/gpu: "1" requests: cpu: '2' memory: 16Gi nvidia.com/gpu: "1"Customize the following parameters in the
specsection of the inference service:-
replicas- Specify the number of replicas. model- Specify the URI to the model based on how the model is stored (uri) and the model name to use in chat completion requests (name).-
S3 bucket:
s3://<bucket-name>/<object-key> -
Persistent volume claim (PVC):
pvc://<claim-name>/<pvc-path> -
OCI container image:
oci://<registry_host>/<org_or_username>/<repository_name><tag_or_digest> -
HuggingFace:
hf://<model>/<optional-hash>
-
S3 bucket:
-
router- Provide an HTTPRoute and gateway, or leave blank to automatically create one.
-
- Save the file.