Skip to navigation

NIM LLM and VLM supports deployment on Google Cloud Platform (GCP) through two approaches. For a product overview, refer to NVIDIA NIM for LLM and VLM Documentation.

  • Google Kubernetes Engine (GKE): Self-managed Kubernetes deployment using Helm charts with complete control over infrastructure, GPU node pools, and persistent storage.
  • Vertex AI: Fully managed ML platform with built-in load balancing, auto-scaling, and automatic authentication.

Both deployment strategies can use Google Cloud Storage (GCS) as the backend for model storage. The following table compares GKE and Vertex AI across common deployment considerations:

AspectGKE (Helm)Vertex AI
Infrastructure ManagementUser manages cluster, nodes, and GPUsFully managed by Google
Deployment Mechanismhelm install commandgcloud ai models upload and gcloud ai endpoints deploy-model
Container Image SourceAny accessible registry, such as NGC or Artifact RegistryArtifact Registry only
Model Artifact SourceNGC, GCS, Hugging Face, local pathNGC, Hugging Face, or GCS
Authentication MethodsNGC API key for model downloads, plus Workload Identity or service account credentials for GCSNGC API key for model downloads, plus Application Default Credentials (ADC) for GCS
ScalingManual or Horizontal Pod Autoscaler (HPA)Built-in automatic autoscaling
Cost ModelNode-based (cost incurred even when idle)Consumption-based with scale-to-zero support
Ideal Use CaseFull control, custom environments, developmentQuick deployment, managed infrastructure, production

Deploy on Google Kubernetes Engine (GKE)

To deploy NIM LLM and VLM on Google Kubernetes Engine (GKE), create a GKE cluster with GPU-enabled node pools and prepare your Google Cloud environment for NIM LLM and VLM workloads.

Prerequisites

Before you proceed, complete the following prerequisites:

  • Create or use a Google Cloud project with permissions for creating GKE clusters and GPU node pools.
  • Confirm sufficient GPU quota in your target region for your chosen GPU type (check in Cloud Console under Quotas).
  • Install the following tools:
    • Google Cloud SDK
    • kubectl (install with gcloud components install kubectl)
    • Helm 3
    • gke-gcloud-auth-plugin

Authenticate and Enable APIs

Authenticate to Google Cloud, select your project, and enable the required services.

  1. Authenticate with the Google Cloud CLI:

    gcloud auth login
  2. Set the active project:

    gcloud config set project ${YOUR_PROJECT_ID}
  3. Authenticate Application Default Credentials:

    gcloud auth application-default login
  4. Enable the required APIs:

    gcloud services enable container.googleapis.com
    gcloud services enable compute.googleapis.com
    gcloud services enable storage.googleapis.com
    gcloud services enable artifactregistry.googleapis.com

Set Environment Variables

Set environment variables for your GCP project, region, and NIM deployment. Update the placeholder values with your own:

export GCP_PROJECT="${YOUR_PROJECT_ID}"
export GCP_REGION="${YOUR_REGION}" # for example, europe-west4, us-central1
export GCP_ZONE="${YOUR_ZONE}" # for example, europe-west4-a
export NGC_API_KEY="${YOUR_NGC_API_KEY}"
export GCS_BUCKET="${YOUR_BUCKET_NAME}"
export GKE_CLUSTER="${YOUR_CLUSTER_NAME}"
export NODE_POOL="gpu-pool"
export NAMESPACE="default"

Create GKE Cluster

Create the network and GKE control plane before you add a GPU node pool for NIM LLM workloads.

Create VPC Network

Create a dedicated VPC network for the GKE cluster:

gcloud compute networks create nim-network --subnet-mode=auto

Create Cluster

Create the GKE cluster in that network:

gcloud container clusters create $GKE_CLUSTER \
--project $GCP_PROJECT \
--zone $GCP_ZONE \
--network=nim-network \
--subnetwork=nim-network \
--machine-type e2-standard-4 \
--num-nodes 1 \
--release-channel regular \
--image-type COS_CONTAINERD

Add GPU Node Pool

NIM requires GPU nodes. First, check available GPU types in your zone:

gcloud compute accelerator-types list --filter="zone:$GCP_ZONE" --format="table(name,zone)"

Choose a GPU type and count that match your model profile in the Support Matrix for PB NIMs. This example creates a GPU node pool with one NVIDIA A100 80 GB GPU for the Lightning model-specific NIM:

gcloud container node-pools create $NODE_POOL \
--cluster $GKE_CLUSTER \
--project $GCP_PROJECT \
--zone $GCP_ZONE \
--machine-type a2-ultragpu-1g \
--accelerator type=nvidia-a100-80gb,count=1,gpu-driver-version=latest \
--num-nodes 1 \
--image-type COS_CONTAINERD \
--scopes cloud-platform \
--disk-size 200

Setting gpu-driver-version=latest triggers automatic NVIDIA driver installation, eliminating the need for a separate DaemonSet.

Get Cluster Credentials

This command fetches the cluster endpoint and authentication credentials from GCP and writes them to your local kubeconfig file (~/.kube/config).

gcloud container clusters get-credentials $GKE_CLUSTER \
--zone $GCP_ZONE --project $GCP_PROJECT

Afterward, kubectl commands target your new cluster.

Verify GPU Availability

Confirm that at least one node advertises GPU capacity:

kubectl get nodes -o custom-columns='NAME:.metadata.name,GPU:.status.allocatable.nvidia\.com/gpu,STATUS:.status.conditions[-1].type'

You should observe at least one node with a GPU count of 1.

Create Secrets

Create the secrets that the deployment uses to pull the container image and access the model repository.

NGC Registry Secret

Create the NGC secrets for image pulls and model access:

  1. Create the ngc-secret registry secret.

    kubectl create secret docker-registry ngc-secret \
    --namespace $NAMESPACE \
    --docker-server=nvcr.io \
    --docker-username='$oauthtoken' \
    --docker-password="$NGC_API_KEY"
  2. Create the ngc-api secret that stores the NGC API key.

    kubectl create secret generic ngc-api \
    --namespace $NAMESPACE \
    --from-literal=NGC_API_KEY="$NGC_API_KEY"

Hugging Face Token for Gated Models

Optional: If you are deploying a gated Hugging Face model, create an additional secret with your Hugging Face token. NGC models and ungated public Hugging Face models do not require a token.

kubectl create secret generic hf-token \
--namespace $NAMESPACE \
--from-literal=HF_TOKEN="${YOUR_HF_TOKEN}"

Reference in Helm with model.hfTokenSecret: hf-token.

Helm Deployment

Create one of the following values files based on whether you are deploying a model-specific image, a generic image, or a model stored in GCS.

Model-Specific NIM

Use this option for NIM images built for a specific model, such as NVIDIA Nemotron 3.5 Lightning 30B-A3B.

Create values-gke-prebuilt.yaml:

image:
repository: nvcr.io/nim/nvidia/nemotron-3.5-lightning-30b-a3b-pb7
tag: "2.1.5-pb7.0"
pullPolicy: IfNotPresent
model:
name: nvidia/nemotron-3.5-lightning
ngcAPISecret: ngc-api
nimCache: /model-store
openaiPort: 8000
logLevel: INFO
resources:
limits:
nvidia.com/gpu: 1
requests:
nvidia.com/gpu: 1
persistence:
enabled: true
size: 100Gi
storageClass: premium-rwo
imagePullSecrets:
- name: ngc-secret
tolerations:
- key: "nvidia.com/gpu"
operator: "Exists"
effect: "NoSchedule"
# livenessProbe.timeoutSeconds defaults to 1. /v1/health/live is served by
# nginx directly (returns 200 without touching the backend), so the endpoint
# itself is effectively instant. The override below guards against transient
# kubelet-to-pod network latency that could otherwise trip a 1-second budget
# and cause a spurious restart during model load. Skip if your cluster's
# baseline latency profile is stable. Readiness and startup use
# /v1/health/ready and already ship with 30-second timeouts.
livenessProbe:
timeoutSeconds: 10
service:
type: LoadBalancer
openaiPort: 8000

Model-Free NIM with GCS Storage

Use this option to serve custom or fine-tuned models stored in GCS with standard directory structure.

Save these values as values-gke-model-free.yaml and replace YOUR_BUCKET_NAME with your GCS bucket name.

image:
repository: nvcr.io/nim/nvidia/model-free-nim-pb7
tag: "2.1.5-pb7.0"
pullPolicy: IfNotPresent
model:
name: my-custom-model
ngcAPISecret: ngc-api
nimCache: /model-store
openaiPort: 8000
logLevel: INFO
env:
- name: NIM_MODEL_PATH
value: "gs://YOUR_BUCKET_NAME/my-org/my-model"
- name: NIM_SERVED_MODEL_NAME
value: "my-custom-model"
- name: NIM_MAX_MODEL_LEN
value: "4096"
resources:
limits:
nvidia.com/gpu: 1
requests:
nvidia.com/gpu: 1
persistence:
enabled: true
size: 100Gi
storageClass: premium-rwo
imagePullSecrets:
- name: ngc-secret
tolerations:
- key: "nvidia.com/gpu"
operator: "Exists"
effect: "NoSchedule"
# livenessProbe.timeoutSeconds defaults to 1. /v1/health/live is served by
# nginx directly (returns 200 without touching the backend), so the endpoint
# itself is effectively instant. The override below guards against transient
# kubelet-to-pod network latency that could otherwise trip a 1-second budget
# and cause a spurious restart during model load. Skip if your cluster's
# baseline latency profile is stable. Readiness and startup use
# /v1/health/ready and already ship with 30-second timeouts.
livenessProbe:
timeoutSeconds: 10
service:
type: LoadBalancer
openaiPort: 8000

For NIM_MODEL_PATH with GCS, ensure your model is uploaded with standard directory structure, not percent-encoded keys. Refer to GCS Use Cases: Model-Free vs Repository Override for upload instructions.

Use Workload Identity or a node service account with GCS access so pods can obtain credentials without a key file. To test with a service account key, create the secret in the same namespace:

kubectl create secret generic gcp-sa-key --namespace "$NAMESPACE" \
--from-file=sa.json=/path/to/sa.json

Append this item to the existing env list in your Helm values file:

- name: GOOGLE_APPLICATION_CREDENTIALS
value: "/credentials/sa.json"

Add these top-level Helm values to mount the secret:

extraVolumes:
gcp-credentials:
secret:
secretName: gcp-sa-key
extraVolumeMounts:
gcp-credentials:
mountPath: /credentials
readOnly: true

The imagePullSecrets examples above list ngc-secret, which only authenticates to nvcr.io. When you deploy an image stored in Artifact Registry, the nodes also need pull access to ${GCP_REGION}-docker.pkg.dev. Use one of the following, in addition to ngc-secret:

  • Grant the node service account roles/artifactregistry.reader (recommended for production, no token expiry).

  • Create an ar-pull docker-registry secret that uses a short-lived access token, then add it to imagePullSecrets:

    kubectl create secret docker-registry ar-pull \
    --namespace $NAMESPACE \
    --docker-server=${GCP_REGION}-docker.pkg.dev \
    --docker-username=oauth2accesstoken \
    --docker-password="$(gcloud auth print-access-token)"

    The access token is valid for about one hour, so prefer roles/artifactregistry.reader on the node service account for long-running deployments.

Install the Helm Release

Follow Fetch the Helm Chart to download and extract a PB7-compatible chart. From the parent directory of the extracted nim-llm/ chart, install the release:

export RELEASE_NAME="my-nim"
helm upgrade --install "$RELEASE_NAME" ./nim-llm \
--namespace $NAMESPACE \
-f values-gke-prebuilt.yaml \
--timeout 45m \
--wait

For the generic (model-free) image, use -f values-gke-model-free.yaml instead.

Monitor Deployment

Monitor the deployment:

kubectl -n $NAMESPACE get pods -l "app.kubernetes.io/name=nim-llm" -w

Wait until the pod status is Running and ready.

Configure Network Access

GKE often blocks non-standard ports. Create a firewall rule:

gcloud compute firewall-rules create allow-nim-8000 \
--network=nim-network \
--allow=tcp:8000 \
--source-ranges=0.0.0.0/0 \
--description="Allow NIM API port 8000"

GKE automatically provisions firewall rules for type: LoadBalancer services in most clusters, so this rule is usually not needed. Create allow-nim-8000 manually only if your environment prevents GKE from auto-creating load balancer firewall rules (for example, restricted IAM permissions, a shared VPC, or an org firewall policy). In that case, the LoadBalancer IP is assigned but traffic to port 8000 is dropped, so the health check and chat completion tests appear to hang.

Test the GKE Deployment

Use the following steps to get the service endpoint and verify that the deployment responds to requests.

Get the Endpoint

For LoadBalancer service, wait for the external IP to be assigned:

kubectl -n $NAMESPACE get svc -l "app.kubernetes.io/name=nim-llm" -w
# Wait until EXTERNAL-IP changes from <pending> to an IP address, then Ctrl+C
export NIM_IP=$(kubectl -n $NAMESPACE get svc -l "app.kubernetes.io/name=nim-llm" \
-o jsonpath='{.items[0].status.loadBalancer.ingress[0].ip}')
echo "NIM endpoint: http://$NIM_IP:8000"

For ClusterIP service, use port-forward:

kubectl -n $NAMESPACE port-forward svc/${RELEASE_NAME}-nim-llm 8000:8000

Health Check

Confirm the NIM API is up and ready:

curl -s "http://$NIM_IP:8000/v1/health/ready"

Test Chat Completions

Send a test chat completion request and verify inference is working:

curl -X POST "http://$NIM_IP:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
-d '{"model": "nvidia/nemotron-3.5-lightning", "messages": [{"role": "user", "content": "Hello!"}], "max_tokens": 256}'

For the Model-Free example, change the request’s model field to my-custom-model. To confirm the name your deployment serves, query /v1/models.

Run Helm Tests

Run the suite of Helm chart tests for your release:

helm test $RELEASE_NAME -n $NAMESPACE

View Logs

View real-time logs for your deployed NIM pods:

kubectl -n $NAMESPACE logs -l "app.kubernetes.io/name=nim-llm" -f

GKE Model Sourcing Options

Provide an NGC API key through the Helm model.ngcAPISecret value whenever NIM needs to download model files. For gated Hugging Face models, also configure model.hfTokenSecret. A complete local model store can start without an NGC key.

SourceMethodSource Configuration
NGC (built-in manifest)Container downloads from NGC at startupUse the model-specific PB7 image
NGC directNIM generates a manifest and downloads from NGCNIM_MODEL_PATH=ngc://org/model:ver
NGC mirrored to GCSModel files in GCS with percent-encoded keysNIM_REPOSITORY_OVERRIDE=gs://bucket (refer to Model Storage Options)
GCS directNIM loads a model from a standard GCS directoryNIM_MODEL_PATH=gs://bucket/path/to/model
Hugging Face directNIM generates a manifest and downloads from Hugging FaceNIM_MODEL_PATH=hf://org/model
Local pathModel files pre-loaded on a persistent volume or host pathNIM_MODEL_PATH=/opt/nim/models/

GKE Authentication

GKE supports multiple authentication methods for GCS access:

MethodUse CaseConfiguration
Application Default Credentials (ADC)Local developmentRun gcloud auth application-default login
Workload IdentityProduction GKELink a Kubernetes (K8s) service account to a GCP service account
Service Account JSONCI/CD pipelinesSet GOOGLE_APPLICATION_CREDENTIALS

Workload Identity is the recommended approach for production GKE deployments. It eliminates the need for credential files in pods.

Remove the GKE Resources

Use these steps to remove the deployment and its GKE resources.

To remove the GKE resources, complete the following steps:

Uninstall Helm Release

Uninstall the Helm release:

helm uninstall $RELEASE_NAME -n $NAMESPACE

Delete PVCs

Delete the persistent volume claims:

kubectl delete pvc -n $NAMESPACE -l app.kubernetes.io/name=nim-llm

Delete GKE Cluster

Delete the GKE cluster:

gcloud container clusters delete $GKE_CLUSTER --zone=$GCP_ZONE --quiet

Optional: Delete Firewall Rule

Delete the firewall rule if you created it earlier:

gcloud compute firewall-rules delete allow-nim-8000 --quiet

Delete VPC Network

Delete the VPC network:

gcloud compute networks delete nim-network --quiet

Deploy on Vertex AI

Vertex AI is a fully managed ML platform that provides load balancing and autoscaling. Application Default Credentials (ADC) give the deployment access to GCS.

To deploy on Vertex AI, complete the following steps.

Key Constraints

Vertex AI has specific requirements that differ from GKE deployments:

AspectRequirement
Container ImagesUse an image stored in Artifact Registry
Model StorageGCS optional (required only for GCS-backed artifacts or used as a mirror). By default, NIM downloads model artifacts at runtime from the NGC or Hugging Face image manifest given outbound network access. GCS using the gs:// protocol is required only when artifacts are GCS-backed (NIM_REPOSITORY_OVERRIDE or NIM_MODEL_PATH=gs://) or used as an optional mirror
AuthenticationADC grants GCS access. NIM also requires an NGC API key when startup downloads model files.

Prerequisites

Before you proceed, complete the following prerequisites:

  • Create or use a GCP project with permissions for Vertex AI, Artifact Registry, and GCS.
  • Confirm sufficient GPU quota in your region for your chosen GPU type (check in Cloud Console under Quotas).
  • Install the following tools:
    • Google Cloud SDK
    • Docker (for pushing images to Artifact Registry)
    • Optional: pip install google-cloud-aiplatform for Python SDK access

Initial Setup

Complete the following setup steps before you deploy NIM on Vertex AI.

Authenticate and Enable APIs

Authenticate to Google Cloud, select your project, and enable the required services.

  1. Authenticate with the Google Cloud CLI:

    gcloud auth login
  2. Set the active project:

    gcloud config set project ${YOUR_PROJECT_ID}
  3. Authenticate Application Default Credentials:

    gcloud auth application-default login
  4. Enable the required APIs:

    gcloud services enable aiplatform.googleapis.com
    gcloud services enable artifactregistry.googleapis.com
    gcloud services enable storage.googleapis.com
    gcloud services enable compute.googleapis.com

The API must be enabled before proceeding. If you encounter errors indicating that the API is disabled, run the gcloud services enable commands and wait one to two minutes.

Set Environment Variables

Set the environment variables for your Google Cloud resources:

export GCP_PROJECT="${YOUR_PROJECT_ID}"
export GCP_REGION="${YOUR_REGION}" # for example, europe-west4, us-central1
export GCS_BUCKET="${YOUR_GCS_BUCKET}" # for GCS-backed models
export NGC_API_KEY="${YOUR_NGC_API_KEY}"
export AR_REPO="${YOUR_AR_REPO}" # for example, nim-repo
export AR_REPO_URI="${GCP_REGION}-docker.pkg.dev/${GCP_PROJECT}/${AR_REPO}"

Create GCS Bucket and Grant Access

For a GCS-backed model, create the bucket and grant Vertex AI permission to read from it.

  1. Create the bucket:

    gsutil mb -l $GCP_REGION -p $GCP_PROJECT gs://$GCS_BUCKET
  2. Create the Vertex AI service identity if this is your first Vertex AI deployment in the project:

    gcloud beta services identity create --service=aiplatform.googleapis.com --project=$GCP_PROJECT
  3. Get the project number:

    PROJECT_NUMBER=$(gcloud projects describe $GCP_PROJECT --format="value(projectNumber)")
  4. Grant the Vertex AI service agent access to the bucket:

    gsutil iam ch \
    serviceAccount:service-${PROJECT_NUMBER}@gcp-sa-aiplatform.iam.gserviceaccount.com:objectViewer \
    gs://$GCS_BUCKET

If deployment fails with a permission error for custom-online-prediction@TENANT_ID-tp.iam.gserviceaccount.com, extract the TENANT_ID from the error and grant access:

export TENANT_ID=${TENANT_ID_FROM_ERROR}
gsutil iam ch \
serviceAccount:custom-online-prediction@${TENANT_ID}-tp.iam.gserviceaccount.com:objectViewer \
gs://$GCS_BUCKET

Create Artifact Registry Repository

Create the Artifact Registry repository, grant Vertex AI access, and configure Docker authentication.

  1. Create the repository:

    gcloud artifacts repositories create $AR_REPO \
    --repository-format=docker \
    --location=$GCP_REGION \
    --project=$GCP_PROJECT
  2. Get the project number:

    PROJECT_NUMBER=$(gcloud projects describe $GCP_PROJECT --format="value(projectNumber)")
  3. Grant the Vertex AI service agent read access to Artifact Registry:

    gcloud projects add-iam-policy-binding $GCP_PROJECT \
    --member="serviceAccount:service-${PROJECT_NUMBER}@gcp-sa-aiplatform.iam.gserviceaccount.com" \
    --role="roles/artifactregistry.reader"
  4. Configure Docker authentication for Artifact Registry:

    gcloud auth configure-docker ${GCP_REGION}-docker.pkg.dev

Push NIM Image to Artifact Registry

Copy the PB7 NIM image to Artifact Registry. Choose the image that matches how you plan to register the model.

  1. Log in to NGC:

    docker login nvcr.io --username '$oauthtoken' --password-stdin <<< "$NGC_API_KEY"
  2. Set the source image and tag. Use the model-specific image for its built-in manifest or a GCS mirror. Use the Model-Free image for a custom model in GCS.

    export NIM_IMAGE="nvcr.io/nim/nvidia/nemotron-3.5-lightning-30b-a3b-pb7:2.1.5-pb7.0"
    # For Model-Free, use:
    # export NIM_IMAGE="nvcr.io/nim/nvidia/model-free-nim-pb7:2.1.5-pb7.0"
    export AR_IMAGE="${AR_REPO_URI}/${NIM_IMAGE##*/}"
  3. Pull, tag, and push the image:

    docker pull "$NIM_IMAGE"
    docker tag "$NIM_IMAGE" "$AR_IMAGE"
    docker push "$AR_IMAGE"

Upload Model to GCS

GCS is optional (required only for GCS-backed artifacts or used as a mirror). By default, NIM downloads model artifacts at runtime from the NGC or Hugging Face image manifest given outbound network access. Upload artifacts to GCS only when they are GCS-backed (NIM_REPOSITORY_OVERRIDE or NIM_MODEL_PATH=gs://) or used as an optional mirror. Refer to Model Storage Options for upload instructions.

Register Model in Vertex AI

Register the NIM container as a Vertex AI model. Choose the command for your source. NIM retrieves model files at startup. Set NGC_API_KEY for every remote source, including GCS. ADC grants access to GCS. A model-specific image can download directly from NGC when the endpoint has outbound access.

For the Built-in Manifest (Default)

Use the model-specific PB7 image you pushed to Artifact Registry:

export MODEL_DISPLAY_NAME="nim-llm-lightning"
export SERVED_MODEL_NAME="nvidia/nemotron-3.5-lightning"
gcloud ai models upload --region="$GCP_REGION" \
--display-name="$MODEL_DISPLAY_NAME" \
--container-image-uri="$AR_IMAGE" \
--container-ports=8000 \
--container-health-route=/v1/health/ready \
--container-predict-route=/v1/chat/completions \
--container-shared-memory-size-mb=2048 \
--container-env-vars="NGC_API_KEY=${NGC_API_KEY}"

For NIM_REPOSITORY_OVERRIDE

Use the model-specific PB7 image with the GCS bucket prepared by the NGC mirror workflow:

export MODEL_DISPLAY_NAME="nim-llm-lightning-gcs"
export SERVED_MODEL_NAME="nvidia/nemotron-3.5-lightning"
gcloud ai models upload --region="$GCP_REGION" \
--display-name="$MODEL_DISPLAY_NAME" \
--container-image-uri="$AR_IMAGE" \
--container-ports=8000 \
--container-health-route=/v1/health/ready \
--container-predict-route=/v1/chat/completions \
--container-shared-memory-size-mb=2048 \
--container-env-vars="NIM_REPOSITORY_OVERRIDE=gs://${GCS_BUCKET},NGC_API_KEY=${NGC_API_KEY}"

For NIM_MODEL_PATH

Use the PB7 Model-Free image with a compatible model uploaded to GCS in its standard directory structure:

export MODEL_DISPLAY_NAME="nim-llm-custom"
export SERVED_MODEL_NAME="my-custom-model"
gcloud ai models upload --region="$GCP_REGION" \
--display-name="$MODEL_DISPLAY_NAME" \
--container-image-uri="$AR_IMAGE" \
--container-ports=8000 \
--container-health-route=/v1/health/ready \
--container-predict-route=/v1/chat/completions \
--container-shared-memory-size-mb=2048 \
--container-env-vars="NIM_MODEL_PATH=gs://${GCS_BUCKET}/my-org/my-model,NIM_SERVED_MODEL_NAME=${SERVED_MODEL_NAME},NGC_API_KEY=${NGC_API_KEY}"

Create Endpoint and Deploy

Choose a Vertex AI configuration with a GPU driver that supports CUDA 13.0 or later. Check GPU availability for your region. Vertex AI compute configuration

The following example uses one NVIDIA A100 80 GB GPU for the Lightning image. For a different model, choose a machine type and GPU count that match your model profile. Complete these steps in the same shell session as the model registration:

  1. Create the endpoint:

    gcloud ai endpoints create --region=$GCP_REGION --display-name=nim-llm-endpoint
  2. Get the endpoint and model IDs:

    ENDPOINT_ID=$(gcloud ai endpoints list --region=$GCP_REGION \
    --filter="displayName:nim-llm-endpoint" --format="value(name)" | awk -F/ '{print $NF}')
    MODEL_ID=$(gcloud ai models list --region=$GCP_REGION \
    --filter="displayName:${MODEL_DISPLAY_NAME}" --format="value(name)" | awk -F/ '{print $NF}')
  3. Deploy the model with the beta CLI to request a minimum GPU driver version.

    gcloud beta ai endpoints deploy-model "$ENDPOINT_ID" --region="$GCP_REGION" \
    --model="$MODEL_ID" \
    --display-name=nim-llm-v1 \
    --machine-type=a2-ultragpu-1g \
    --accelerator=type=nvidia-a100-80gb,count=1 \
    --min-gpu-driver-version=580.65.06 \
    --min-replica-count=1 \
    --max-replica-count=3 \
    --traffic-split=0=100

Test the Vertex AI Endpoint

Vertex AI endpoints are accessed through the Vertex AI REST API using rawPredict:

ENDPOINT_URL="https://${GCP_REGION}-aiplatform.googleapis.com/v1/projects/${GCP_PROJECT}/locations/${GCP_REGION}/endpoints/${ENDPOINT_ID}"
curl -X POST "${ENDPOINT_URL}:rawPredict" \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-d '{"model":"'"$SERVED_MODEL_NAME"'","messages":[{"role":"user","content":"Hello!"}],"max_tokens":50}'

Use the same SERVED_MODEL_NAME you set when registering the model.

Remove the Vertex AI Resources

Use this section to remove the deployed Vertex AI resources and related artifacts.

To remove the Vertex AI resources, complete the following steps:

Undeploy and Delete Resources

To programmatically clean up your deployed Vertex AI resources and remove related artifacts, you can use the following commands:

# Use the MODEL_DISPLAY_NAME from the model registration step.
export ENDPOINT_DISPLAY_NAME="nim-llm-endpoint"
# Find endpoint ID
ENDPOINT_ID=$(gcloud ai endpoints list --region=$GCP_REGION --project=$GCP_PROJECT \
--filter="displayName:${ENDPOINT_DISPLAY_NAME}" --format='value(name)' | head -1)
# Undeploy model from endpoint
if [[ -n "$ENDPOINT_ID" ]]; then
DEPLOYED_MODEL_ID=$(gcloud ai endpoints describe $ENDPOINT_ID \
--region=$GCP_REGION --project=$GCP_PROJECT \
--format='value(deployedModels.id)' | head -1)
if [[ -n "$DEPLOYED_MODEL_ID" ]]; then
gcloud ai endpoints undeploy-model $ENDPOINT_ID \
--region=$GCP_REGION \
--project=$GCP_PROJECT \
--deployed-model-id=$DEPLOYED_MODEL_ID \
--quiet
fi
fi
# Delete endpoint
if [[ -n "$ENDPOINT_ID" ]]; then
gcloud ai endpoints delete $ENDPOINT_ID \
--region=$GCP_REGION \
--project=$GCP_PROJECT \
--quiet
fi
# Find and delete model from registry
MODEL_ID=$(gcloud ai models list --region=$GCP_REGION --project=$GCP_PROJECT \
--filter="displayName:${MODEL_DISPLAY_NAME}" --format='value(name)' | head -1)
if [[ -n "$MODEL_ID" ]]; then
gcloud ai models delete $MODEL_ID \
--region=$GCP_REGION \
--project=$GCP_PROJECT \
--quiet
fi
# Delete Artifact Registry image
gcloud artifacts docker images delete "$AR_IMAGE" \
--project=$GCP_PROJECT \
--quiet

Delete Infrastructure

Optional: To fully clean up your project resources—including removing the Artifact Registry repository and deleting all objects and the bucket itself from Google Cloud Storage—run the following commands:

# Delete Artifact Registry repository
gcloud artifacts repositories delete $AR_REPO \
--location=$GCP_REGION \
--project=$GCP_PROJECT \
--quiet
# Delete all objects in the GCS bucket and remove the bucket
gsutil -m rm -r "gs://${GCS_BUCKET}/**"
gsutil rb "gs://${GCS_BUCKET}"

Serve Models from Google Cloud Storage

Use NIM_REPOSITORY_OVERRIDE to serve files from a mirrored model-specific NGC manifest. Use NIM_MODEL_PATH with the Model-Free image to serve a compatible model stored in a standard GCS directory. Both methods require an NGC API key when startup downloads model files, plus credentials that can read the bucket.

NIM_REPOSITORY_OVERRIDE (NGC Mirror)

Run mirror gcs from the PB7 model-specific image. It downloads the manifest’s NGC files and uploads them as percent-encoded GCS keys derived from their original URIs. At startup, NIM rewrites the manifest URIs to those keys and verifies files against the original checksums.

Set GCS_BUCKET to the bucket name without the gs:// prefix. Use a service account key with permission to write to the bucket.

export NGC_API_KEY="${YOUR_NGC_API_KEY}"
export GCS_BUCKET="${YOUR_GCS_BUCKET}"
export GCS_CREDENTIALS="/path/to/sa.json"
export NIM_LLM_IMAGE="nvcr.io/nim/nvidia/nemotron-3.5-lightning-30b-a3b-pb7:2.1.5-pb7.0"
docker run --rm \
-e NGC_API_KEY \
-e GOOGLE_APPLICATION_CREDENTIALS=/credentials/sa.json \
-v "$GCS_CREDENTIALS:/credentials/sa.json:ro" \
"$NIM_LLM_IMAGE" \
mirror gcs -b "$GCS_BUCKET" -m /opt/nim/etc/default/model_manifest.yaml

To serve the mirrored model with Docker, use a service account key with read access and set NIM_REPOSITORY_OVERRIDE to the bucket URI. On GKE or Vertex AI, grant bucket access to the workload’s service account and use its ADC credentials instead of mounting a key file.

docker run --rm --gpus=all \
-e NGC_API_KEY \
-e NIM_REPOSITORY_OVERRIDE="gs://${GCS_BUCKET}" \
-e GOOGLE_APPLICATION_CREDENTIALS=/credentials/sa.json \
-v "$GCS_CREDENTIALS:/credentials/sa.json:ro" \
-p 8000:8000 \
"$NIM_LLM_IMAGE"

NIM_MODEL_PATH (Model-Free)

Upload a compatible model’s checkpoint, configuration, and tokenizer files to a GCS prefix with the same directory layout as the local model. NIM generates the model manifest at startup.

export NGC_API_KEY="${YOUR_NGC_API_KEY}"
export GCS_BUCKET="${YOUR_GCS_BUCKET}"
export GCS_CREDENTIALS="/path/to/sa.json"
export NIM_LLM_MODEL_FREE_IMAGE="nvcr.io/nim/nvidia/model-free-nim-pb7:2.1.5-pb7.0"
export NIM_MODEL_PATH="gs://${GCS_BUCKET}/my-org/my-model"
gsutil -m rsync -r ./my-model/ "$NIM_MODEL_PATH"

Check that config.json is available directly at gs://${GCS_BUCKET}/my-org/my-model/config.json. Run the PB7 Model-Free image and use my-custom-model as the model name in requests.

docker run --rm --gpus=all \
-e NGC_API_KEY \
-e NIM_MODEL_PATH \
-e NIM_SERVED_MODEL_NAME=my-custom-model \
-e GOOGLE_APPLICATION_CREDENTIALS=/credentials/sa.json \
-v "$GCS_CREDENTIALS:/credentials/sa.json:ro" \
-p 8000:8000 \
"$NIM_LLM_MODEL_FREE_IMAGE"

For GKE or Vertex AI with ADC, use the corresponding deployment examples above. Grant the workload’s service account read access to the GCS prefix.

Comparison

The following table compares the two GCS-based model-loading approaches and highlights when to use each one.

AspectNIM_REPOSITORY_OVERRIDENIM_MODEL_PATH=gs://
PurposeServe NGC model from GCSServe custom model from GCS
Model-free mode?No (model-specific container)Yes (generic container)
Model originNGC (has pre-built manifest + checksums)Customer-uploaded (no manifest)
Upload toolmirror gcs in the PB7 imagegsutil rsync or another GCS upload tool
GCS key formatPercent-encoded flat keysNormal directory structure
ManifestBuilt into container at build timeGenerated at runtime by nimlib
Manifest URI protocolngc:// (rewritten to gs:// at runtime)gsrepo://
ChecksumsBLAKE3 from NGC (pre-computed)BLAKE3 computed during manifest generation
Double download?No (checksums come from the file, so download happens one time)No (computed from cache and served from cache)
PB7 imageModel-specificModel-Free

These two approaches use incompatible key formats. Files uploaded with percent-encoding cannot be consumed by NIM_MODEL_PATH=gs:// (expects directory structure), and vice versa.

Authenticate to Google Cloud Storage

GCS supports Application Default Credentials (ADC). Authentication is resolved in the following order:

  1. GOOGLE_APPLICATION_CREDENTIALS environment variable pointing to a service account key file
  2. Vertex AI managed environment credentials
  3. Google Compute Engine (GCE) metadata service
  4. Cloud Run environment
  5. gcloud CLI user credentials
VariableRequiredPurpose
GOOGLE_APPLICATION_CREDENTIALSYes (unless using ADC)Path to service account JSON key file
GCS_ENDPOINT_URLOnly for GCS emulatorsCustom endpoint (for example, http://localhost:4443 for fake-gcs)
STORAGE_EMULATOR_HOSTOnly for GCS emulatorsEnables anonymous access for GCS emulators

Troubleshoot Google Cloud Deployments

Use the following troubleshooting tables to diagnose common deployment issues on GKE and Vertex AI.

GKE Issues

The following table lists common GKE deployment issues and recommended resolutions.

IssueResolution
GKE API not enabledRun gcloud services enable container.googleapis.com and wait 1-2 minutes
Pod status: PendingVerify GPU node pool exists, tolerations match, and PVC is bound
Pod status: ImagePullBackOffCheck imagePullSecrets and NGC_API_KEY validity
Pod status: CrashLoopBackOffCheck logs with kubectl logs, verify environment variables
Startup probe failureModel loading can take up to 30 minutes for large models. Increase failureThreshold if needed.
No GPU detectedVerify nvidia.com/gpu in node capacity, and ensure that gpu-driver-version=latest was set.
LoadBalancer stuck pendingCheck GCP permissions. This process can take several minutes.
Port 8000 blockedCreate firewall rule to allow TCP port 8000

Vertex AI Issues

The following table lists common Vertex AI deployment issues and recommended resolutions.

IssueResolution
Vertex AI API not enabledRun gcloud services enable aiplatform.googleapis.com and wait 1-2 minutes
RuntimeError: The NVIDIA driver on your system is too oldThe deployment is using a GPU driver below the required version. Follow Create Endpoint and Deploy to request a minimum driver of 580.65.06 using the beta CLI.
Deployment stuckModel loading takes 20 to 45 minutes. Check operation status with gcloud ai operations list --region=$GCP_REGION.
401 error on GCS bucketGrant Vertex AI service account access to the bucket
Permission denied for custom-online-predictionGrant the tenant project service account objectViewer access to the GCS bucket
Image pull failedVerify image is in Artifact Registry and Vertex AI has artifactregistry.reader role
Model URI missing version suffixUse a generic model-free image with NIM_MODEL_PATH instead of model-specific images

For additional troubleshooting, refer to Support and FAQ.

Next Steps

Refer to the following Google Cloud documentation for more information: