Skip to navigation

Air-Gap Deployment

View as MarkdownOpen in Claude

Air-gap deployment lets you run a NIM without an internet connection, for example, with no connection to remote model registries such as NGC or Hugging Face Hub. For a product overview, refer to NVIDIA NIM for LLM and VLM Documentation.

This guide describes how to prepare, transfer, and run NIM LLM and VLM in an air-gapped environment with either vLLM or SGLang. Use the same container image and model in both phases so the cached profiles match your deployment.

Air-gap deployment follows a two-phase workflow:

  1. Network-connected phase: On a machine with internet access and credentials, download model assets and prepare them for transfer.
  2. Air-gapped phase: On the isolated machine, mount the pre-staged model assets and run the NIM container with no outbound network access and no API keys.

Transfer the model assets between these phases using any allowed channel, such as an archive copy, scp, rsync, or physical media.

In the air-gapped phase, do not set NGC_API_KEY or HF_TOKEN. The NIM must load all model assets from local storage only.

Prerequisites

Before you start, complete the following prerequisites:

  1. On the network-connected host, install Docker and obtain credentials for the model source you will pre-stage (NGC_API_KEY or HF_TOKEN as required).
  2. Decide whether you will use a model-specific image or a model-free image, as described in Choose a Deployment Modality.
  3. On the air-gapped host, provide a place to mount the transferred cache, model store, or local model directory. Do not set NGC_API_KEY or HF_TOKEN in that phase.

Choose a Deployment Modality

NIM LLM and VLM supports two deployment modalities. Your choice affects how you prepare model assets for an air-gapped deployment.

Model-Specific NIM

For model-specific NIM, keep the following in mind:

  • The NIM container ships with a model manifest that defines the model and one or more profiles (tensor parallel size, backend, and so on).
  • Use a model-specific container image for this workflow, such as ${NIM_LLM_MODEL_SPECIFIC_IMAGE}:2.1.6.
  • Model weights are not shipped inside the container. At startup, NIM loads the model from cache if present, or downloads it when the system has network and credentials.
  • For air-gap, you must pre-stage the model using download-to-cache (and optionally create-model-store) during the connected phase, then transfer the cache or model store to the air-gapped system.
  • A fine-tune of the NIM’s model in a local directory needs no pre-staging: mount it and set NIM_MODEL_PATH to it. The NIM serves its own profiles from those files. A profile that uses a separate speculative-decoding draft model needs the draft staged locally as well (see Serving a Fine-Tuned Checkpoint on a Model-Specific NIM).

Model-Free NIM

For model-free NIM, keep the following in mind:

  • The model is configured at runtime by the user, using NIM_MODEL_PATH or the positional model argument on the container command line (refer to Model Path as a Container Argument in Model-Free NIM). The container does not ship a fixed model manifest.
  • Use a model-free container image for this workflow, such as ${NIM_LLM_MODEL_FREE_IMAGE}:2.1.6.
  • When NIM_MODEL_PATH points to a local path (for example, /mnt/models/my-llama), NIM serves directly from that path. No download occurs, so if the model directory is already present on the air-gapped system, you do not need to use download-to-cache or create-model-store.
  • When NIM_MODEL_PATH is a remote URI (for example, ngc://org/team/model:tag), NIM generates a runtime manifest on the first deployment and automatically persists it inside NIM_CACHE_PATH, together with a key (nim_runtime_manifest.key.json) recording the model and the image that generated it. On subsequent restarts (including in strict air-gap environments) with the same image and NIM_MODEL_PATH, NIM finds the cached manifest in the same cache volume and skips regeneration, making no outbound network or authentication calls. No extra environment variables are required; mounting the same PVC at NIM_CACHE_PATH is sufficient. If the model or the image has changed, NIM tries to regenerate the manifest first and falls back to the cached one only if that fails. If the key shows the cached manifest was generated for a different model or backend, NIM exits with an error instead of falling back. The cache must also hold every model asset the manifest references.

Set ${NIM_LLM_MODEL_FREE_IMAGE} or ${NIM_LLM_MODEL_SPECIFIC_IMAGE} to the image for your model and inference engine listed in the Support Matrix for NIMs.

Quick Reference

The following table summarizes the model source location at runtime, the container image to use, and how the model is accessed:

NIM TypeContainer ImageNIM_MODEL_PATH valueDownload at Startup?Air-Gap support
Regular NIM${NIM_LLM_MODEL_SPECIFIC_IMAGE}(not used)Yes, if not in cacheYes, pre-stage the cache
Regular NIM${NIM_LLM_MODEL_SPECIFIC_IMAGE}Local model store, or a fine-tune of the NIM’s model (for example, /mnt/model)No, served from the local files; a speculative-decoding draft is downloaded unless staged locallyYes, mount the directory; set NIM_MODEL_PROFILE to the store’s profile ID to serve that profile; for a profile with a draft model, see Serving a Fine-Tuned Checkpoint on a Model-Specific NIM
Model-free NIM${NIM_LLM_MODEL_FREE_IMAGE}Local path (for example, /mnt/model)NoYes, ensure local path is mounted
Model-free NIM${NIM_LLM_MODEL_FREE_IMAGE}Remote URI (for example, ngc://...), first deployYes, generates manifestRequires network on first deploy
Model-free NIM${NIM_LLM_MODEL_FREE_IMAGE}Remote URI (for example, ngc://...), redeploy with manifest on PVCNoYes, manifest reused from PVC with no auth calls when it was generated by the same image for the same NIM_MODEL_PATH; the model assets must be cached too

Download Model Assets (Network-Connected Phase)

On a machine with internet access, use the NIM container to download model assets and optionally create a model store directory.

To download model assets on a network-connected host, complete the following steps.

Use a container image that matches your workflow:

  • For model-specific NIM, use ${NIM_LLM_MODEL_SPECIFIC_IMAGE}:2.1.6.
  • For model-free NIM, use ${NIM_LLM_MODEL_FREE_IMAGE}:2.1.6.

Download a Model to Cache

The download-to-cache command downloads selected or default model profiles to the NIM cache.

  1. Run download-to-cache for the profile you need:

    docker run -it --rm --gpus all \
    -e NGC_API_KEY \
    -v "$LOCAL_NIM_CACHE:/opt/nim/.cache" \
    ${NIM_LLM_MODEL_SPECIFIC_IMAGE}:2.1.6 \
    download-to-cache -p <PROFILE_HASH>

    You can also download all profiles with --all, or let NIM auto-select a profile based on the available hardware by omitting the -p flag.

Run list-model-profiles to discover available profiles and their hashes before downloading.

Use a profile ID or description from list-model-profiles in the image you plan to deploy. Profile descriptions identify the inference engine with a vllm- or sglang- prefix.

Create a Model Store

The create-model-store command extracts files from a cached model profile and creates a properly formatted model directory. If the profile is not already cached, the command downloads it first.

docker run -it --rm --gpus all \
-e NGC_API_KEY \
-v "$LOCAL_NIM_CACHE:/opt/nim/.cache" \
-v "$MODEL_REPO:/model-repo" \
${NIM_LLM_MODEL_SPECIFIC_IMAGE}:2.1.6 \
create-model-store -p <PROFILE_HASH> -m /model-repo

The resulting directory is ready for transfer to the air-gapped system.

When a model-specific NIM serves the store through NIM_MODEL_PATH, it applies its own profiles, including their tuned engine arguments, to the store’s files. Keep the <PROFILE_HASH>: setting NIM_MODEL_PROFILE to it serves that profile; without it, the NIM picks a profile for the hardware, as it does for NVIDIA’s weights.

Prepare Container Images

For Kubernetes deployments, every image referenced by the downloaded Helm chart must be available from a registry that the air-gapped cluster can reach. At a minimum, mirror the NIM image. Also mirror any images used by enabled init containers, extra init containers, sidecars, Helm tests, or platform components such as the GPU Operator. For example, when initContainers.ngcInit is enabled, the chart adds an ngc-model-puller init container that uses buildpack-deps:bookworm by default. Each user-defined initContainers.extraInit entry can reference an additional image.

Use the network-connected machine to pull and archive the images. The provided helper script packages the Helm chart, records the image list, optionally copies values and manifests, saves images, and creates a transfer archive. Because the documentation site does not distribute executable shell files, copy airgap-bundle.sh and airgap-load-images.sh from Air-Gap Helper Scripts into the same local directory first:

export AIRGAP_TOOLS_DIR=/path/to/airgap-tools
export NIM_LLM_CHART_DIR=/path/to/unpacked/nim-llm-chart
"$AIRGAP_TOOLS_DIR/airgap-bundle.sh" \
--chart-dir "$NIM_LLM_CHART_DIR" \
--image "${NIM_LLM_MODEL_FREE_IMAGE}:2.1.6" \
--values /path/to/airgap-values.yaml \
--manifest /path/to/deny-egress.yaml \
--output-dir ./nim-airgap-bundle

The script copies each values file into $AIRGAP_BUNDLE/values/ using its original filename. Note the filename you pass so you can reference it during installation.

You can repeat --image, --values, and --manifest, or pass an image list with --images-file. Add images for enabled init containers, extra init containers, sidecars, Helm tests, and platform components such as the GPU Operator.

The following commands show the equivalent manual image steps:

export NIM_IMAGE="${NIM_LLM_MODEL_FREE_IMAGE}:2.1.6"
export AIRGAP_BUNDLE="${AIRGAP_BUNDLE:-$(pwd)/nim-airgap-bundle}"
mkdir -p "$AIRGAP_BUNDLE/images"
cat > "$AIRGAP_BUNDLE/images/images.txt" <<EOF
$NIM_IMAGE
EOF
# Add these only if your values enable them:
# buildpack-deps:bookworm # initContainers.ngcInit default image
# curlimages/curl:8.6.0 # helm test hooks
# <images from initContainers.extraInit>
# <platform images, for example GPU Operator images>
while IFS= read -r image; do
[ -n "$image" ] || continue
docker pull "$image"
done < "$AIRGAP_BUNDLE/images/images.txt"
docker save \
--output "$AIRGAP_BUNDLE/images/nim-images.tar" \
$(tr '\n' ' ' < "$AIRGAP_BUNDLE/images/images.txt")

In the air-gapped environment, extract the bundle, load the image archive, and push the images to the local registry:

tar -xzf nim-airgap-bundle.tar.gz
export AIRGAP_BUNDLE="$(pwd)/nim-airgap-bundle"
export AIRGAP_REGISTRY=registry.airgap.example.com/nim
"$AIRGAP_BUNDLE/tools/airgap-load-images.sh" \
--bundle-dir "$AIRGAP_BUNDLE" \
--registry "$AIRGAP_REGISTRY"

The following commands show the equivalent manual image load and push steps:

docker load --input "$AIRGAP_BUNDLE/images/nim-images.tar"
while IFS= read -r image; do
[ -n "$image" ] || continue
name_tag="${image##*/}"
docker tag "$image" "$AIRGAP_REGISTRY/$name_tag"
docker push "$AIRGAP_REGISTRY/$name_tag"
done < "$AIRGAP_BUNDLE/images/images.txt"

Record the rewritten image name because you will use it in the Helm values. For example, if ${NIM_LLM_MODEL_FREE_IMAGE}:2.1.6 becomes registry.airgap.example.com/nim/nim-llm:2.1.6, set:

image:
repository: registry.airgap.example.com/nim/nim-llm
tag: "2.1.6"
pullPolicy: IfNotPresent

Keep the chart’s default probes on /v1/health/ready and /v1/health/live for either inference engine.

If the air-gapped registry requires authentication, create an image pull secret in the target namespace and reference it with imagePullSecrets.

Bundle Helm Charts and Deployment Recipes

Package the Helm chart and any site-specific values files, manifests, or deployment recipes on the network-connected machine. If you used the provided airgap-bundle.sh, this is already done. To perform the steps manually, complete the following:

export AIRGAP_BUNDLE="${AIRGAP_BUNDLE:-$(pwd)/nim-airgap-bundle}"
mkdir -p "$AIRGAP_BUNDLE/charts" "$AIRGAP_BUNDLE/values" "$AIRGAP_BUNDLE/manifests"
helm package "$NIM_LLM_CHART_DIR" --destination "$AIRGAP_BUNDLE/charts"
# Copy the exact values files and manifests you plan to apply offline.
cp "$NIM_LLM_CHART_DIR/values.yaml" "$AIRGAP_BUNDLE/values/values.yaml"
cp /path/to/your-airgap-values.yaml "$AIRGAP_BUNDLE/values/airgap-values.yaml"

Create a transfer archive after images, model assets, charts, and values are ready:

tar -C "$(dirname "$AIRGAP_BUNDLE")" \
-czf nim-airgap-bundle.tar.gz \
"$(basename "$AIRGAP_BUNDLE")"

In the air-gapped environment, extract the bundle before installing:

tar -xzf nim-airgap-bundle.tar.gz
export AIRGAP_BUNDLE="$(pwd)/nim-airgap-bundle"

Transfer Model Assets

Transfer the model store directory (or cache) from the connected machine to the air-gapped environment. To transfer model assets, use one of the following methods:

  • Archive and copy: Create a tar or zip archive, transfer it through an allowed channel, then extract it on the air-gapped host.
  • scp or rsync: Use direct directory transfer when a one-way or out-of-band SSH path is available. rsync supports incremental synchronization.
  • Physical media: Copy the directory or archive onto portable storage (for example, a USB drive), physically move it to the air-gapped environment, then extract it.

Run in an Air-Gapped Environment

On the air-gapped system, mount the pre-staged model directory and run the NIM container.

To run NIM LLM and VLM without outbound network access, complete the following steps.

Use a Model Store

Run the following commands to use a model store:

Use the same container image that you used to create the model store. The model store can contain settings specific to that image’s inference engine.

  1. Set the runtime variables:

    export CONTAINER_NAME=nim-airgap
    export MODEL_REPO=/path/to/model-repository
    export NIM_SERVED_MODEL_NAME=my-model
  2. Start the NIM container. Set NIM_MODEL_PROFILE to the <PROFILE_HASH> that you passed to create-model-store -p:

    docker run -it --rm --name="$CONTAINER_NAME" \
    --gpus all \
    --shm-size=16GB \
    -p 8000:8000 \
    -e NIM_MODEL_PATH=/model-repo \
    -e NIM_MODEL_PROFILE=<PROFILE_HASH> \
    -e NIM_SERVED_MODEL_NAME \
    -v "$MODEL_REPO:/model-repo" \
    ${NIM_LLM_MODEL_SPECIFIC_IMAGE}:2.1.6

    Without NIM_MODEL_PROFILE, the NIM selects a profile for the hardware, which can differ from the profile that the store was created from. On multi-GPU hardware, it can select a profile whose speculative-decoding draft model is not in the store, for example Gemma 4 31B’s 071b2dab profile on two B200 GPUs. The NIM then tries to download that draft and fails without network access.

Do not set NGC_API_KEY or HF_TOKEN in this phase.

Use Model-Free NIM with a Remote URI (PVC-Based Redeploy)

If you use model-free NIM with NIM_MODEL_PATH set to a remote URI (for example, ngc://org/team/model:tag), NIM generates a runtime manifest on the first deployment and automatically saves a copy inside NIM_CACHE_PATH.

On subsequent restarts (including in a strict air-gap environment) NIM finds the cached manifest in the same cache volume and skips regeneration, making no outbound network or authentication calls. No additional environment variables are required. Prepare that cache with the same model and container image before moving to the isolated environment.

NIM reuses the cached manifest this way only when its key, nim_runtime_manifest.key.json in the same directory, shows it was generated for the same NIM_MODEL_PATH by the same container image. Otherwise (a different model, a different image or tuned recipes, an earlier generation that could not complete, or a cache written by an image that predates the key) NIM tries to regenerate the manifest first. Without network access that attempt fails and NIM falls back to the cached manifest, logging a warning. The exception is a cached manifest whose key shows it was generated for a different NIM_MODEL_PATH or backend: serving it would load the other model’s files, or profiles made for the other backend, so NIM exits with an error instead. Start once with access to the model source to generate the manifest, or mount a cache volume made for this model and backend.

Prerequisites:

  • The NIM cache from the first (network-connected) deployment must be on a persistent volume (PVC) that is re-mounted between deployments. Both model assets and the manifest, with its key, are stored there.
  • The air-gapped deployment must use the same container image and NIM_MODEL_PATH as the network-connected one. After an image upgrade, run one network-connected start to refresh the cached manifest and its key.
  1. Set the runtime variables:

    export CONTAINER_NAME=nim-airgap-model-free
    export LOCAL_NIM_CACHE=/path/to/persistent-nim-cache # same PVC used on first deploy
    export NIM_MODEL_PATH=ngc://org/team/model:tag
  2. Start the NIM container:

    docker run -it --rm --name="$CONTAINER_NAME" \
    --gpus all \
    --shm-size=16GB \
    -p 8000:8000 \
    -e NIM_MODEL_PATH \
    -v "$LOCAL_NIM_CACHE:/opt/nim/.cache" \
    ${NIM_LLM_MODEL_FREE_IMAGE}:2.1.6

    NIM detects the cached manifest and its matching key in /opt/nim/.cache, serves from the model assets cached there, and starts without any outbound network access.

Do not set NGC_API_KEY in the air-gap phase. If the cache volume is not mounted or was not populated by a prior network-connected deployment, NIM cannot fall back to the required manifest and model assets and fails in a strict air-gap environment.

Use a separate cache for each model and container image. Before changing either in an air-gapped deployment, prepare and transfer a matching cache on a network-connected host.

The cached manifest is reused on network-connected restarts too, as long as the image and NIM_MODEL_PATH are unchanged. A NIM_MODEL_PATH that names a moving reference (such as a :latest tag or a Hugging Face branch) therefore keeps serving the files it was first resolved to. Pin NIM_MODEL_PATH to a fixed version, or, to force manifest regeneration (for example, after an upstream model update), delete nim_runtime_manifest.yaml or nim_runtime_manifest.key.json from your persistent cache directory before restarting.

Use the Offline Cache

If you prefer to transfer the cache rather than a model store, mount the cache and specify the profile as shown in the following commands:

Use the same container image that you used to populate the cache. Select a profile from that image’s list-model-profiles output.

  1. Set the runtime variables:

    export CONTAINER_NAME=nim-airgap
    export AIR_GAP_NIM_CACHE=/path/to/transferred-cache
    export PROFILE_HASH=<PROFILE_HASH>
  2. Start the NIM container:

    docker run -it --rm --name="$CONTAINER_NAME" \
    --gpus all \
    --shm-size=16GB \
    -p 8000:8000 \
    -e NIM_MODEL_PROFILE="$PROFILE_HASH" \
    -v "$AIR_GAP_NIM_CACHE:/opt/nim/.cache" \
    ${NIM_LLM_MODEL_SPECIFIC_IMAGE}:2.1.6

Model-Free NIM with a Local Path

When using a model-free NIM with a local model path, no download occurs at startup. If the model directory is already on the air-gapped system, you can run without download-to-cache or create-model-store and without any API keys:

  1. Set the container name and model repository path:

    export CONTAINER_NAME=nim-airgap
    export MODEL_REPO=/path/to/model-repo
  2. Run the NIM container with the local model path:

    docker run -it --rm --name="$CONTAINER_NAME" \
    --gpus all \
    --shm-size=16GB \
    -p 8000:8000 \
    -e NIM_SERVED_MODEL_NAME=my-model \
    -e NIM_MODEL_PATH=/model-repo \
    -v "$MODEL_REPO:/model-repo" \
    ${NIM_LLM_MODEL_FREE_IMAGE}:2.1.6

Profiles with a Speculative-Decoding Draft Model

Some profiles use speculative decoding with a separate draft model. A profile can bundle its draft with the model files. download-to-cache and create-model-store stage such a draft with the model, and a model store holds it in a subdirectory such as eagle3_draft/. A profile can instead name its draft only in the draft_uri key of its nim_json_args tag, and the NIM downloads such a draft at startup. In release 2.1.6, the following applies to such a draft:

  • The download-to-cache and create-model-store commands do not include it.
  • The NIM contacts the draft’s registry at every start, even when the NIM cache already holds the draft, and exits if it cannot reach the registry.

To serve such a profile without network access, download the draft and point the NIM at it by path. Complete the following steps:

  1. Find the profile’s draft. In the profile’s nim_json_args tag, the nim_specdec object names the draft in its draft_uri key, such as hf://<org>/<draft>:<revision>. Its speculative config names the draft’s subdirectory, such as dspark_draft. list-model-profiles does not print this tag, so read it from the manifest. A model-specific NIM ships its manifest at /opt/nim/etc/default/model_manifest.yaml. A model-free NIM saves the manifest that it generates for a remote NIM_MODEL_PATH as nim_runtime_manifest.yaml in the NIM cache. When the NIM cannot download the draft at startup, its Failed to download draft model from error names the draft and its subdirectory.

    These steps apply only when the speculative config names the draft by a bare subdirectory name, such as dspark_draft or eagle3_draft. Some profiles name the draft by repository ID instead, such as Gemma 4 31B’s google/gemma-4-31B-it-assistant. The inference engine then downloads the draft itself, and in release 2.1.6 the NIM uses neither NIM_DRAFT_MODEL_PATH nor a local copy for it. To serve such a profile without network access, set NIM_SPECDEC_ENABLE=0.

  2. On a network-connected host, download the base model as described in Download Model Assets (Network-Connected Phase).

  3. On the same host, download the draft into the same NIM cache with download-to-cache and the draft’s URI. Use the image that you deploy:

    export NIM_IMAGE=${NIM_LLM_MODEL_FREE_IMAGE}:2.1.6 # or the model-specific image you deploy
    export DRAFT_URI="hf://<org>/<draft>:<revision>" # the profile's draft_uri
    docker run -it --rm \
    -e HF_TOKEN \
    -v "$LOCAL_NIM_CACHE:/opt/nim/.cache" \
    "$NIM_IMAGE" \
    download-to-cache --model-uri "$DRAFT_URI"

    The draft is stored in the cache under huggingface/hub/models--<org>--<draft>/snapshots/<revision>/. Pass HF_TOKEN for a gated draft or to avoid anonymous rate limits. For a draft on NGC, pass -e NGC_API_KEY instead.

  4. Transfer the NIM cache directory to the air-gapped system with the other model assets.

  5. On the air-gapped system, start the NIM with the cache mounted and one of the following settings:

    • Set NIM_DRAFT_MODEL_PATH to the draft’s snapshot directory in the container, for example, -e NIM_DRAFT_MODEL_PATH=/opt/nim/.cache/huggingface/hub/models--<org>--<draft>/snapshots/<revision>. In release 2.1.6, the NIM does not use a draft that is only in the cache on its own, so set this path.
    • Copy the draft into a local model directory, in the subdirectory that the speculative config names, and set NIM_MODEL_PATH to that directory, as in Use a Model Store or Model-Free NIM with a Local Path.
    • Set NIM_SPECDEC_ENABLE=0 to serve without speculative decoding.

For more information about NIM_DRAFT_MODEL_PATH and NIM_SPECDEC_ENABLE, refer to Speculative Decoding.

Validate Offline Docker Networking

To verify the container has no outbound network access, add --network none and omit -p 8000:8000. Docker does not publish host ports in that mode, so probe from inside the container:

docker exec nim-airgap curl -sf http://127.0.0.1:8000/v1/health/ready

On a physically isolated host, keep -p 8000:8000 and skip --network none.

SGLang Attention Backend Failures on Grace Hopper and ARM

On some linux/arm64 and Grace Hopper (GH200) hosts, SGLang’s default FlashAttention-3 backend fails at scheduler start with the following error:

ImportError: Can not import FA3 in sgl_kernel. Please check your installation.

This error concerns the attention backend on the host GPU. It can occur even when all model assets are available locally.

Select a supported attention backend with a container argument:

docker run -it --rm --name=nim-airgap \
--gpus all \
--shm-size=16GB \
-p 8000:8000 \
-e NIM_MODEL_PATH=/model-repo \
-e NIM_SERVED_MODEL_NAME=my-model \
-v "$MODEL_REPO:/model-repo" \
${NIM_LLM_MODEL_FREE_IMAGE}:2.1.6 \
--attention-backend triton

For the Helm chart, pass the same argument through customArgs:

customArgs:
- "--attention-backend"
- "triton"

Select an attention backend supported by your GPU and container image. Refer to Advanced Configuration for other deployment interfaces.

Deploy on Kubernetes in an Air-Gapped Environment

Use this workflow when the air-gapped environment is a Kubernetes cluster with a private registry mirror.

To deploy on Kubernetes in an air gap, complete the following steps.

Prepare Air-Gap Values

Create a values file that points to the private registry and uses only local model storage. Do not include model.ngcAPIKey, model.ngcAPISecret, model.hfTokenSecret, NGC_API_KEY, or HF_TOKEN in the air-gapped values.

For a model-free NIM with a pre-staged local model directory, use the following:

image:
repository: registry.airgap.example.com/nim/nim-llm
tag: "2.1.6"
pullPolicy: IfNotPresent
imagePullSecrets: []
model:
modelPath: /model-store/my-model
name: my-model
ngcAPISecret: ""
hfTokenSecret: ""
persistence:
enabled: true
existingClaim: nim-model-store
env:
- name: NIM_SERVED_MODEL_NAME
value: my-model

If you are using a pre-populated NIM cache instead of a local model directory, mount the cache at model.nimCache. When a model-specific NIM requires a specific profile, set NIM_MODEL_PROFILE through env. For single-node deployments, model.profile is only applied to multi-node deployments, so use env here instead:

model:
nimCache: /model-store
env:
- name: NIM_MODEL_PROFILE
value: "<PROFILE_HASH>"
persistence:
enabled: true
existingClaim: nim-model-cache

Install from the Bundled Chart

Install with the chart archive and values file from the transfer bundle:

kubectl create namespace nim-service
helm upgrade --install nim-llm \
"$AIRGAP_BUNDLE"/charts/nim-llm-*.tgz \
--namespace nim-service \
--values "$AIRGAP_BUNDLE/values/airgap-values.yaml"

Replace airgap-values.yaml with the filename you passed to --values when creating the bundle. Run ls "$AIRGAP_BUNDLE/values/" to confirm the exact name.

Wait for the pod to become ready:

kubectl rollout status statefulset/nim-llm -n nim-service --timeout=60m

If your values render a Deployment instead of a StatefulSet, use the following:

kubectl rollout status deployment/nim-llm -n nim-service --timeout=60m

Validate Without Internet Access

Port-forward the service and validate health, model listing, and inference:

kubectl port-forward -n nim-service service/nim-llm 8000:8000

In another terminal, run the following:

curl -sf http://127.0.0.1:8000/v1/health/ready
curl -sf http://127.0.0.1:8000/v1/models
curl -sf http://127.0.0.1:8000/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{
"model": "my-model",
"messages": [{"role": "user", "content": "Say hello in one sentence."}],
"max_tokens": 16
}'

For a stronger validation, block egress from the NIM namespace with a default-deny egress NetworkPolicy before starting the release. Keep DNS and private registry access only if your cluster requires those paths for image pulls or service discovery.

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: deny-egress
namespace: nim-service
spec:
podSelector: {}
policyTypes:
- Egress

This policy blocks all egress. If your cluster needs DNS resolution or in-cluster registry access after the image is pulled, add matching egress rules (for example, to kube-dns on UDP/TCP 53 and to your private registry) so those paths still work.

Then restart the pod and repeat the smoke test:

kubectl rollout restart statefulset/nim-llm -n nim-service
kubectl rollout status statefulset/nim-llm -n nim-service --timeout=60m

Configure a Proxy and Certificates

If the network-connected phase runs behind a corporate or outbound proxy, you must configure the standard proxy environment variables so that downloads are routed correctly.

HTTP/HTTPS Proxy

When running the network-connected phase behind a proxy, you can specify environment variables to direct HTTP and HTTPS traffic through your organization’s proxy servers. The following variables are commonly used for proxy configuration:

VariableDescription
HTTP_PROXYProxy server for HTTP connections
HTTPS_PROXYProxy server for HTTPS connections
NO_PROXYComma-separated list of hostnames, domains, or IPs that should bypass the proxy

In the air-gapped phase, there is no outbound traffic so proxy variables are not needed.

CA Certificate Injection

When outbound HTTPS traffic goes through a TLS-inspecting proxy, or when downloading from a corporate registry whose TLS certificate is signed by an internal CA, you must inject the corporate Certificate Authority (CA) certificate so that TLS verification succeeds. Set SSL_CERT_FILE to point to a combined CA bundle inside the container.

Setting SSL_CERT_FILE replaces the container’s default trust store. If you point it at a file containing only your corporate CA, connections to public endpoints (such as api.ngc.nvidia.com) will fail because the public CAs are no longer trusted. Always create a combined bundle that includes the default CAs and your corporate CA.

Create a combined CA bundle (one-time, on the host):

To add your corporate CA without losing trust in public CAs, concatenate the container’s default bundle with your corporate CA certificate:

# Extract the default CA bundle from the container
docker run --rm --entrypoint bash \
${NIM_LLM_MODEL_SPECIFIC_IMAGE}:2.1.6 \
-c 'cat /etc/ssl/certs/ca-certificates.crt' > combined-ca-bundle.pem
# Append your corporate CA
cat /path/to/corporate-ca.pem >> combined-ca-bundle.pem

Run with the combined bundle:

Mount and reference the combined bundle:

docker run --rm --gpus all \
-v "$LOCAL_NIM_CACHE:/opt/nim/.cache" \
-v ./combined-ca-bundle.pem:/etc/ssl/certs/custom-ca-bundle.pem:ro \
-e SSL_CERT_FILE=/etc/ssl/certs/custom-ca-bundle.pem \
-e REQUESTS_CA_BUNDLE=/etc/ssl/certs/custom-ca-bundle.pem \
-e NGC_API_KEY \
${NIM_LLM_MODEL_SPECIFIC_IMAGE}:2.1.6 \
download-to-cache --all

If downloading through a proxy, also add -e HTTP_PROXY=... and -e HTTPS_PROXY=.... A proxy is not required for SSL_CERT_FILE to take effect.

CA certificate injection is only relevant during the network-connected phase. After the deployment is fully air-gapped, there is no outbound HTTPS traffic and no CA configuration is needed.

These variables affect outbound TLS (model downloads). They are unrelated to the NIM_SSL_* variables, which configure inbound TLS at the nginx proxy layer. For more information, refer to Environment Variables: SSL and TLS.

Environment Variables

The following environment variables are relevant to air-gap deployment:

VariableDescription
NIM_MODEL_PATHPath to the local model repository or a remote URI. In air-gapped mode, set to the local mount path.
NIM_CACHE_PATHDirectory path for model cache storage inside the container. Default: /opt/nim/.cache.
NIM_MODEL_PROFILEProfile ID to use. Required when running from cache without a model store.
NIM_SERVED_MODEL_NAMEName used for the served model in API responses.
NGC_API_KEYNGC API key for downloading models. Do not set in air-gapped phase.
HF_TOKENHugging Face token for downloading models. Do not set in air-gapped phase.

Harmony Vocabularies for GPT-OSS

Harmony vocabulary files are included in the container image. Preserve the tokenizer environment supplied by that image when deploying GPT-OSS offline:

Image ProviderRequired Environment
Current vLLM stable, vLLM nightly, and CPU images using oss-harmonyLeave TIKTOKEN_ENCODINGS_BASE unset so Harmony uses its embedded vocabularies.
SGLang and legacy images using openai-harmony, including older CPU imagesRetain the image’s nonempty TIKTOKEN_ENCODINGS_BASE path, /opt/nim/tiktoken_encodings, and its bundled vocabulary files.

For oss-harmony, omit this variable from Docker environment arguments and Kubernetes environment settings. An empty value still overrides the embedded vocabularies. Setting a path without the vocabulary files causes tokenizer loading to fail.

For openai-harmony, the directory must contain both cl100k_base.tiktoken and o200k_base.tiktoken. Keep these files available at the image’s configured path. Recheck the image’s Harmony provider before carrying environment overrides across an image upgrade.

Examples

Use the following examples to deploy a NIM in an air-gapped environment for different scenarios.

Download and Create a Model Store

Use this workflow to create a model store on a network-connected system and then run NIM from that model store in the air-gapped environment.

  1. In the network-connected phase, set the required variables and create the local directories:

    export NGC_API_KEY=your_api_key
    export PROFILE_HASH=<your_profile_hash>
    export LOCAL_NIM_CACHE="${LOCAL_NIM_CACHE:-$(pwd)/.cache}"
    export MODEL_REPO=/path/to/model-repository
    mkdir -p "$MODEL_REPO" "$LOCAL_NIM_CACHE"
  2. Download the model to the local cache:

    docker run -it --rm --gpus all \
    -e NGC_API_KEY \
    -v "$LOCAL_NIM_CACHE:/opt/nim/.cache" \
    ${NIM_LLM_MODEL_SPECIFIC_IMAGE}:2.1.6 \
    download-to-cache -p "$PROFILE_HASH"
  3. Create the model store:

    docker run -it --rm --gpus all \
    -e NGC_API_KEY \
    -v "$LOCAL_NIM_CACHE:/opt/nim/.cache" \
    -v "$MODEL_REPO:/model-repo" \
    ${NIM_LLM_MODEL_SPECIFIC_IMAGE}:2.1.6 \
    create-model-store -p "$PROFILE_HASH" -m /model-repo
  4. Transfer the model store to the air-gapped system.

  5. On the air-gapped system, set the runtime variables and start NIM:

    export CONTAINER_NAME=nim-airgap
    export MODEL_REPO=/path/to/model-repository
    export NIM_SERVED_MODEL_NAME=my-model
  6. Start NIM:

    docker run -it --rm --name="$CONTAINER_NAME" \
    --gpus all \
    --shm-size=16GB \
    -p 8000:8000 \
    -e NIM_MODEL_PATH=/model-repo \
    -e NIM_MODEL_PROFILE=<PROFILE_HASH> \
    -e NIM_SERVED_MODEL_NAME \
    -v "$MODEL_REPO:/model-repo" \
    ${NIM_LLM_MODEL_SPECIFIC_IMAGE}:2.1.6

    Set NIM_MODEL_PROFILE to the ID given to create-model-store -p. Without it, a multi-GPU host can select a profile whose draft model is not in the store.

Use the Offline Cache

Use this workflow when you want to transfer the NIM cache instead of creating a model store.

  1. In the network-connected phase, set the required variables and create the cache directory:

    export LOCAL_NIM_CACHE="${LOCAL_NIM_CACHE:-$(pwd)/.cache}"
    export PROFILE_HASH=<your_profile_hash>
    mkdir -p "$LOCAL_NIM_CACHE"
  2. Download the model to the cache:

    docker run --rm --gpus all \
    -v "$LOCAL_NIM_CACHE:/opt/nim/.cache" \
    -e NGC_API_KEY \
    ${NIM_LLM_MODEL_SPECIFIC_IMAGE}:2.1.6 \
    download-to-cache -p "$PROFILE_HASH"
  3. Transfer the cache to the air-gapped system.

  4. On the air-gapped system, set the runtime variables and start NIM:

    export AIR_GAP_NIM_CACHE=/path/to/transferred-cache
    export CONTAINER_NAME=nim-airgap
    export PROFILE_HASH=<your_profile_hash>
  5. Start NIM:

    docker run -it --rm --name="$CONTAINER_NAME" \
    --gpus all \
    --shm-size=16GB \
    -p 8000:8000 \
    -e NIM_MODEL_PROFILE="$PROFILE_HASH" \
    -v "$AIR_GAP_NIM_CACHE:/opt/nim/.cache" \
    ${NIM_LLM_MODEL_SPECIFIC_IMAGE}:2.1.6

Model-Free NIM with a Local Path (No Download Needed)

If the model directory is already on the air-gapped system (for example, copied using secure transfer), you can run directly without any prior download steps:

  1. Set the runtime variables:

    export CONTAINER_NAME=nim-airgap
    export MODEL_REPO=/path/to/model-repo
  2. Start NIM by using the local model path:

    docker run -it --rm --name="$CONTAINER_NAME" \
    --gpus all \
    --shm-size=16GB \
    -p 8000:8000 \
    -e NIM_SERVED_MODEL_NAME=my-model \
    -e NIM_MODEL_PATH=/model-repo \
    -v "$MODEL_REPO:/model-repo" \
    ${NIM_LLM_MODEL_FREE_IMAGE}:2.1.6

Network-Connected Phase with Proxy and CA Certificate

For environments that require an HTTP/HTTPS proxy and custom CA certificates during the download phase, use a combined CA bundle (refer to CA Certificate Injection):

docker run --rm --gpus all \
--add-host=host.docker.internal:host-gateway \
-v ./combined-ca-bundle.pem:/etc/ssl/certs/custom-ca-bundle.pem:ro \
-e NIM_SERVER_PORT=8000 \
-e NIM_SERVED_MODEL_NAME=my-model \
-e NIM_MODEL_PATH=hf://TinyLlama/TinyLlama-1.1B-Chat-v1.0 \
-e HTTP_PROXY=http://host.docker.internal:8888 \
-e HTTPS_PROXY=http://host.docker.internal:8888 \
-e SSL_CERT_FILE=/etc/ssl/certs/custom-ca-bundle.pem \
-e REQUESTS_CA_BUNDLE=/etc/ssl/certs/custom-ca-bundle.pem \
${NIM_LLM_MODEL_FREE_IMAGE}:2.1.6

After the model is pre-staged and transferred, the air-gapped phase does not require proxy or CA certificate configuration.

Next Steps

Continue with helper scripts, source-specific downloads, or model-free URI workflows: