NIM Operator Deployment
The NVIDIA NIM Operator is a Kubernetes operator that manages the lifecycle of NIMs in Kubernetes environments, including deployment, scaling, model caching, and health monitoring.
Deploy NIM LLM and VLM with the NVIDIA NIM Operator through these Kubernetes-native custom resources:
- NIMCache — Manages model artifact caching on persistent storage, so models are downloaded during the initial cache population and reused across pod restarts and scaling events.
- NIMService — Manages the NIM deployment lifecycle, including pod creation, health probes, service exposure, and GPU resource scheduling.
Using the NIM Operator simplifies NIM deployment on Kubernetes by handling common concerns such as image pull secrets, NGC authentication, persistent storage provisioning, and probe configuration.
For operator source code and issue tracking, refer to the NIM Operator GitHub repository.
Prerequisites
Before deploying NIM with the NVIDIA NIM Operator, make sure you have the following:
- A Kubernetes 1.26+ cluster with
kubectlaccess - The NVIDIA GPU Operator installed in the cluster
- A persistent storage provisioner in the cluster for model caching
- An NGC API key for pulling NIM container images and downloading model artifacts
- NIM Operator version 3.0.2+ for NIM LLM and VLM compatibility
Installation
Refer to the NVIDIA NIM Operator installation guide to install the NIM Operator.
Deploy NIM
Complete the following steps to deploy NIM with the NVIDIA NIM Operator.
Create a Namespace
Create a dedicated Kubernetes namespace for NIM. A namespace is a logical partition within a cluster. It isolates resources such as pods, services, secrets, and so on from other workloads. Creating a dedicated namespace for NIM keeps resources organized and helps avoid naming conflicts with other applications in the cluster.
Create Secrets
Create the following secrets for image pulls and model downloads.
-
Create an image pull secret for NGC container registry access:
-
Create a secret with the NGC API key for model downloads:
Create a NIMCache
Complete the following steps to create a NIMCache and wait for the model artifacts to be cached. This avoids re-downloading the model every time a pod starts:
-
Create a
NIMCachecustom resource to pre-download model artifacts to persistent storage:Set
engineto match the inference backend in your container image (vllmorsglang). -
Monitor the caching progress:
-
Wait until the
NIMCachestatus showsReadybefore proceeding.
Create a NIMService
After the cache is ready, create a NIMService custom resource to deploy the NIM service.
Verify the Deployment
Verify that the NIMService and pod are ready, and then test inference with port forwarding.
-
Check the NIMService status:
-
Check that the pod is running:
-
After the NIMService is ready, test inference with port forwarding:
-
Query the
/v1/modelsendpoint to discover the model name to use in inference requests: -
Send a chat completion request using the model name returned by
/v1/models:
Passing Configuration to NIM
Use the NIMService env field for NIM environment variables. For a NIMService that does not set spec.multiNode, use spec.args for backend arguments. The Operator maps spec.args to the NIM container’s Kubernetes arguments, which preserve any NIM_PASSTHROUGH_ARGS value provided by the image and resolve at the higher CLI priority. Do not use spec.args for a multi-node NIMService; the current LeaderWorkerSet path does not propagate it to the leader or worker NIM containers.
For the full list of supported environment variables, refer to Environment Variables. For available API endpoints (inference and management), refer to the API Reference.
The following examples are independent options. Each snippet shows a standalone configuration that you can add to your NIMService spec. Apply only the options that are relevant to your deployment. They are not sequential steps.
Backend Arguments
Model Profile
Log Level
For a NIMService that does not set spec.multiNode, pass additional backend arguments through spec.args. Specify each option and value as a separate list item. Argument names and supported values must match the backend version in the image. The following example uses vLLM arguments:
Do not set NIM_PASSTHROUGH_ARGS in spec.env to only your custom arguments. Kubernetes replaces any value supplied by the image instead of appending to it. If NIM_STRICT_ARG_PROCESSING=true, the NIM exits when a direct argument conflicts with an image-provided passthrough value. For the environment-only fallback and configuration provenance, refer to Advanced Configuration.
For logging configuration details, refer to Logging and Observability.
Monitoring and Autoscaling
Use the following sections to configure metrics collection and autoscaling for operator-managed deployments.
Metrics
NIM LLM and VLM exposes the backend’s native Prometheus metrics at /v1/metrics. Use these metrics for autoscaling, alerting, and capacity planning in operator deployments.
Metric names are backend-native and differ between vLLM and SGLang. Query the deployment’s /v1/metrics endpoint to confirm the exact metric names exposed by your container image.
For available metrics, scrape configuration, and dashboard setup, refer to Logging and Observability. For the vLLM backend, refer to the vLLM production metrics documentation.
ServiceMonitor
The NIMService supports creating a Prometheus ServiceMonitor for automatic metric scraping. The operator hardcodes the metrics endpoint path to /v1/metrics:
Autoscaling
The NIM Operator supports horizontal pod autoscaling (HPA) based on custom Prometheus metrics. Standard CPU and memory metrics are not useful for scaling NIM. Use inference-specific metrics instead.
The following example shows HPA configuration in a NIMService spec:
The vllm:num_requests_waiting metric name is backend-native and applies to the vLLM backend. On an SGLang image, the waiting-queue metric name differs. Query the deployment’s /v1/metrics endpoint to find the correct metric name for your backend before configuring the HPA.
This requires the Prometheus Adapter to be installed and configured to expose the backend’s metrics as Kubernetes custom metrics.
Troubleshooting
The examples below use the resource names from this guide (for example, meta-llama3-8b-instruct). Replace them with the names of your own NIMCache and NIMService resources.
NIMCache Stuck in Pending or NotReady State
If NIMCache remains in Pending or NotReady, use the following checks to isolate the issue:
-
Verify the storage class is available and can provision volumes:
-
Check the PVC status:
-
The NIMCache controller creates a Kubernetes Job named
<nimcache-name>-jobto download model artifacts. Check the job status and its pod logs:If the job fails, it retries up to five times, which is the default
backoffLimit. Check for authentication errors, network issues, or insufficient disk space in the job pod logs. -
Ensure the NGC API key secret is correct and the image pull secret has access to the NIM container image.
-
Check the NIMCache status conditions for details:
NIMService Pod Fails to Start
If the NIMService pod fails to start, use the following checks to isolate the issue:
-
Check pod events:
-
Check pod logs:
-
Verify GPU resources are available:
-
Confirm the NIMCache is in
Readystate before deploying the NIMService. The NIM pod mounts the cache PVC at/model-storeand will fail if the model artifacts are not present. -
If you use a specific model profile through
spec.storage.nimCache.profile, verify that the profile name matches one available in the cached model manifest.
Health Probes Fail
The nginx proxy in the NIM container serves the health endpoints. /v1/health/live responds immediately, even during model loading, while /v1/health/ready only returns 200 after the model is fully loaded. By default, both endpoints use the NIM service port (NIM_SERVER_PORT, which defaults to 8000). If NIM_HEALTH_PORT is set, the health endpoints move to that dedicated port instead.
The operator configures a startup probe on /v1/health/ready with a default failureThreshold of 120 and a periodSeconds of 10, giving the model up to 20 minutes to load before the pod is killed. If readiness or startup probes are failing:
-
For large models that take longer to load, increase the startup probe failure threshold in the NIMService spec:
-
Check that
spec.expose.service.portmatches the port used by the NIM container (default 8000). The operator setsNIM_SERVER_PORTautomatically from this value.
NIM Operator Pod Not Running
If the NIMService or NIMCache resources are not being reconciled, verify the operator itself is healthy:
Additional Resources
Refer to the following resources for more information:
- NVIDIA NIM Operator Documentation — operator installation, NIMService CRD, and managing NIM on Kubernetes.
- NVIDIA NIM Operator GitHub Repository — source code, issues, and contributing.
- NVIDIA GPU Operator Documentation — GPU enablement and device configuration in the cluster.
- Environment Variables — all NIM configuration options.
- API Reference — inference and management endpoints.
- Logging and Observability — structured logging, metrics, and tracing.
- Advanced Configuration — server-level options, TLS, and other runtime settings.