Helm and Kubernetes
This page describes how to deploy NVIDIA NIM for LLMs on Kubernetes using the NIM Helm chart.
Prerequisites
Before deploying NIM with Helm, make sure you have the following:
- A running Kubernetes v1.26 or later cluster with GPU-capable nodes. Use a supported Kubernetes release and the latest available patch version.
- Configured
kubectlaccess to the target cluster - Helm 3.0.0 or later
- An NGC API key for accessing the NIM Helm chart. You also need an NGC API key for NIM container images or model artifacts that do not support keyless access, such as PB, pre-2.0.10, private, or gated assets.
- A storage class that supports persistent volumes for model caching
- For multi-node deployments, the LeaderWorkerSet CRD and controller must be installed in the cluster
To provision Kubernetes with NVIDIA Cloud Native Stack (CNS), refer to Using the Ansible Playbooks.
Fetch and extract the Helm chart before deployment. Go to the NGC Catalog and select the nim-llm Helm chart to pick a version. In most cases, you should select the latest version.
Configure Helm
The following Helm values are the most important settings for a NIM deployment:
image.repository: NIM container image to deploy.image.tag: NIM container image tag.model.ngcAPISecretandimagePullSecrets: optional credentials used for images and model artifacts that require an NGC API key.persistence: storage settings for model cache.resources: GPU limits based on model requirements.env: optional advanced runtime configuration.statefulSet.enabled/deployment.strategy: use Deployment mode with an update strategy such asRecreatewhen spare GPU capacity is limited during upgrades. See Deployment Update Strategy.
Use the following commands to inspect chart documentation and defaults:
Cache and Temporary Directories
Several environment variables are derived from model.nimCache (default: /model-store) at deploy time:
These variables are set automatically in both single-node and multi-node deployments.
If you change model.nimCache, ensure that the underlying volume mount is writable and has sufficient space for all cache subdirectories.
To override OUTLINES_CACHE_DIR independently, add it to the env section in values.yaml:
Minimal Example
Complete the following steps to deploy the minimal Helm example for an eligible public-catalog NIM image and tag that supports keyless access:
-
Create
values.yamlwith a minimal configuration:Set
persistence.storageClassto a StorageClass that is available in your Kubernetes cluster.Adjust
persistence.sizebased on your model size and expected cache usage. -
Install the release:
These values are intentionally minimal and work as a starting point in most clusters.
Add NGC Credentials When Required
If your image, tag, or model artifact requires an NGC API key, create the secrets before installing the chart:
Create the image pull secret:
Create the NGC API key secret:
Update the credential values in values.yaml:
Enable LoRA with Helm
Optional: Complete the following steps to enable LoRA adapters with Helm.
-
Create a dedicated PVC for the LoRA adapters:
-
Add LoRA adapters to the PVC under
/loras. For each adapter, create one directory that contains the adapter artifacts:NIM loads adapters from
NIM_PEFT_SOURCE(/lorasin this example). If the PVC is empty, no LoRA adapters are available at runtime. -
Update
values.yaml: -
Apply the updated values:
For detailed LoRA configuration and runtime behavior, refer to Fine-Tuning with LoRA.
Container Security Context
The containerSecurityContext Helm value sets the Kubernetes
container-level security context
for the NIM container.
It is applied in both single-node and multi-node (LeaderWorkerSet) deployments.
Unlike podSecurityContext, the container-level security context supports the
capabilities field, which is required for certain multi-node configurations.
LeaderWorkerSet Requirement
When you set multiNode.enabled=true, the chart creates LeaderWorkerSet
resources. Install the LeaderWorkerSet CRD and controller before installing the
NIM Helm chart. LeaderWorkerSet requires Kubernetes v1.26 or later.
NVL72 Multi-Node Deployments
GB200 and GB300 NVL72 systems use IMEX (Inter-Memory Exchange) channels for cross-node NVLink communication. The containers must have the following Linux capabilities:
SYS_PTRACE— Required for CUDA IPC and IMEX channel operations across GPUs.IPC_LOCK— Required for pinning memory used by GPUDirect RDMA.
To set these with Helm:
Or add them to your values.yaml:
Deployment Update Strategy
By default the chart deploys a StatefulSet (statefulSet.enabled: true).
When you set statefulSet.enabled: false, the chart creates a Deployment instead.
In that mode you can set deployment.strategy to control Kubernetes
Deployment update strategy.
Use type: Recreate when the cluster cannot spare an extra GPU pod during
upgrades (the default RollingUpdate strategy needs room for a new pod before
the old one terminates):
This value applies only in Deployment mode. It is ignored when
statefulSet.enabled is true.
Pod Priority Class
Use the priorityClassName Helm value to assign a Kubernetes
PriorityClass
to NIM pods. Without a priority class, pods are treated as lowest priority in
the cluster and may be preempted by other workloads.
This is applied to single-node deployments and multi-node (LeaderWorkerSet) leader and worker pods.
The PriorityClass resource must already exist in your cluster before referencing it.
To create a PriorityClass:
Verify Deployment
Verify that the pods and service are ready, and then test inference with port forwarding.
-
Check that the pods are running:
-
Check that the service is available:
-
Port-forward the service for local testing:
-
Call the readiness endpoint to confirm that the service is ready:
A healthy deployment returns an HTTP 200 response from the readiness endpoint.