EQTY LabDocs

Verifiable NIM on GPUs

Run a verifiable NVIDIA NIM on GPUs in a Kata confidential container.

View as Markdown

An NVIDIA NIM optimized for a specific model. Each vNIM has its model associated with the container.

A generic NIM container that lets you specify your own model.

Additional configuration options

Note: vNIMs are based on NVIDIA NIMs. You need a GPU to run them and an NVIDIA API key to download them.

Deploy the vNIM

Save the following pod spec as {{VNIM-APP-NAME}}.yaml:

yaml
apiVersion: v1
kind: Pod
metadata:
  name: {{VNIM-APP-NAME}}
  labels:
    app: {{VNIM-APP-NAME}}
  namespace: default
  annotations:
    io.katacontainers.config.hypervisor.default_memory: "65536"
    io.katacontainers.config.hypervisor.default_vcpus: "16"
spec:
  runtimeClassName: {{RUNTIME}}
  containers:
    - name: {{VNIM-APP-NAME}}-app

      # Works around a mismatch between the NIM's file permissions and its running user.
      securityContext:
        runAsUser: 1000
        runAsGroup: 1000

      image: {{CONTAINER_IMAGE}}
      env:
        - name: NGC_API_KEY
          value: "{{NVAPI}}"
        # Enable notary-signed assets
        - name: EQTY_NOTARY
          value: vcomp-coco
      resources:
        requests:
          nvidia.com/pgpu: {{GPU}}
        limits:
          nvidia.com/pgpu: {{GPU}}

LLM vNIM requires additional environment variables. Add these to the env section above. HF_TOKEN is optional.

REMINDER NIM_MODEL_PATH should start with a uri like hf:// to tell the NIM where the model is.

yaml
        - name: NIM_MODEL_PATH
          value: {{MODEL_NAME}}
        - name: HF_TOKEN # optional
          value: hf.... # optional

Apply it to the cluster:

bash
kubectl apply -f {{VNIM-APP-NAME}}.yaml
---
apiVersion: v1
kind: Service
metadata:
  name: simple-py
spec:
  type: NodePort
  selector:
    app: simple-py
  ports:
    - port: 8000
      targetPort: 8000
      nodePort: 30800
---
apiVersion: v1
kind: Service
metadata:
  name: simple-py
spec:
  type: LoadBalancer
  selector:
    app: simple-py
  ports:
    - port: 8080
      targetPort: 8080

Test the vNIM

bash
curl localhost:8080/v1/chat/completions -H 'Content-Type: application/json' \
-d '{"model":"{{MODEL_NAME}}","messages":[{"role":"user","content":"hi"}]}'