Skip to content

V1 gpu autoscaling with K8s recipe - #14009

Closed
maggiezha wants to merge 13 commits into
NVIDIA:v1from
maggiezha:v1
Closed

maggiezha wants to merge 13 commits into
NVIDIA:v1from
maggiezha:v1

Conversation

@maggiezha

@maggiezha maggiezha commented Oct 30, 2026 •

Copy link
Copy Markdown

Outcome

Make the autoscaling recipe for NemoClaw V0 work with NemoClaw V1.

Reason

The v1 sandboxes are Nemo Fabric sandboxes, and they no longer call https://inference.local.

Changes

v0 sent every sandbox to the GPU chart through the OpenShell name https://inference.local. v1 does not use that name. The autoscaling recipe copies the official v1 pattern instead.

Sandbox. nemoclaw apply creates one sandbox per user on the managed OpenShell gateway and starts fabric-agent-ctl serve. The harness is the only difference between the three steps:

6a OpenClaw: nvidia.fabric.openclaw
6b Hermes: nvidia.fabric.hermes
6c Deep Agents: nvidia.fabric.langchain.deepagents
Inference. Each YAML sets inferenceProviders to the GPU chart Service that is already installed:

http://nemoclaw-gpu-metrics-proxy.nemoclaw-gpu.svc.cluster.local:8081/v1

The credential is GPU_INFERENCE_API_KEY. OpenShell stores that key and attaches the provider. The agent route names the model (llama3.2:3b, Nemotron on vLLM, or Nemotron on NIM). The chart, Horizontal Pod Autoscaler, and Envoy load balancer stay the v0 ones. v1 does not install a second chart and does not put inference.local back.

Prompts. The documented operator path is openshell sandbox exec, then fabric-agent-ctl invoke inside the sandbox. These files use authentication.profile: development, which gives the operator no gateway token, so the load clients reach that same Fabric invoke with kubectl exec. Fabric did not choose that hop. v1-invoke.sh is the gateway path after an oidc issuer exists. That issuer was not added.

6b Hermes + vLLM and 6c Deep Agents + NIM completed GPU-utilization and latency runs on this path. 6a OpenClaw + Ollama uses the same Fabric sandbox and the same Service URL.

Verification

Recorded on one DGX (8 GPUs, one held by another workload, HPA maximum 8, Helm 4.3.0).
HPA: peak 8, back to 1, successful chats and 0 errors.

Signed-off-by: Maggie Zhang [email protected]

maggiezha and others added 4 commits October 29, 2026 20:40
…6b path

Bring the v0 Kubernetes GPU-autoscaling recipe (GPU Helm chart, HPA scripts,
Envoy load balancer) into examples/ and add a v1/ folder that runs step 6b
(Hermes + vLLM) on NemoClaw v1.

- v1/: pairing YAMLs converted to the current schema (maps for providers and
  sandboxes, routes under agent.inference), render/check/invoke helpers, and a
  load client that drives v1 sandboxes through fabric-agent-ctl invoke.
- v1/scripts/v1-set-hpa-metric.sh switches the chart between GPU-utilization
  and latency HPA metrics without touching the runtime.
- scripts/install-hpa.sh: add --force-conflicts for the Prometheus Adapter
  upgrade on Helm 4 through the existing version-gated helper.
- .helmignore: exclude v1/ so nemoclaw state is not packaged into the chart.
- v1/RESULTS-6b.md: GPU-utilization and latency runs, both reached 7 GPUs and
  scaled back to 1 with 0 failed chats.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…e load tests

- v1-client-deepagents.sh: Deep Agents defaults for the shared v1 load client.
- v1-client-hermes.sh / e2e-hermes-v1-load-test.py: agent-aware (V1_AGENT_KIND),
  tolerant answer extraction, and v1 wording in the printed summary.
- v1/README.md: how to run the 6b and 6c load tests, and why v1-invoke.sh needs
  the oidc profile.
- v1/RESULTS-6c.md: GPU-utilization and latency runs. Deep Agents reached 7 GPUs
  and scaled back to 1 with 0 failed chats; 1 chat in flight per user stayed at 5.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Stop tool-loop hangs, default TARGET_PODS to 8, and keep inference on the GPU chart Service /v1.
OpenClaw and Hermes load clients reach the sandboxes with kubectl through an SSH tunnel.
@copy-pr-bot

copy-pr-bot Bot commented Oct 30, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@wscurran wscurran added area: docs Documentation, examples, guides, or docs build area: observability Logging, metrics, tracing, diagnostics, or debug output area: performance Latency, throughput, resource use, benchmarks, or scaling area: providers Inference provider integrations and provider behavior area: security Security controls, permissions, secrets, or hardening feature PR adds or expands user-visible functionality integration: dcode LangChain Deep Code integration behavior integration: hermes Hermes integration behavior integration: openclaw OpenClaw integration behavior platform: k8s Affects Kubernetes deployments provider: nvidia NVIDIA inference endpoint, NIM, or NVIDIA provider behavior provider: ollama Ollama local model provider behavior provider: vllm vLLM local or hosted provider behavior v1 NemoClaw v1 branch labels Oct 30, 2026
Maggie Zhang and others added 2 commits October 30, 2026 14:16
The GPU autoscaling recipe ships Chart.yaml and templates under examples/. Those files became journey tests, so clippy rejected Chart.yaml and the walker would parse Helm as NemoClaw config.
@maggiezha

Copy link
Copy Markdown
Author
Authoring session — opening
Field Status Value Evidence or limit
Harness partial Cursor; Claude This chat is Cursor. Commits a587577 and eb49aa4 have Co-Authored-By Claude Sonnet 5.5. Harness versions and earlier chats are not in one session export.
Skills unavailable - No complete skill injection record for the whole pull request.
Instruction files unavailable - No complete instruction-file read record for the whole pull request.
Tool calls unavailable - Tool invocations were not counted from a session export.
Session window unavailable - The pull request spans multiple chats; no single start and cutoff.
Compactions unavailable - Compaction events were not counted from a session export.
Models partial Claude Sonnet 5.5; Grok 4.7 Co-Authored-By on a587577 and eb49aa4; this chat is Grok 4.7. Other turns are outside that record.
Reasoning levels unavailable - Reasoning settings were not recorded.

Maggie Zhang and others added 7 commits October 30, 2026 14:58
Place the Fabric pairing files and clients at the recipe root, and
remove the nested folder and the older sandbox workflow so this
example stands on its own.
The GPU recipe's Hermes pairing is the vLLM file. Example tests were
parsing the chart and monitoring YAML as NemoClaw configs, so cargo ci test
failed on every platform.
The DGX prints the HPA. Clients only send chats with INFLIGHT and
MAX_TOKENS and read maxReplicas instead of patching it.
The apply plan prints the Fabric harness lines. The HPA watch is the GPU chart, so a run with live sandbox pods skips apply.
Show how install-hpa.sh starts the chart and how nemoclaw apply starts the sandboxes, and put the architecture figure back.
Add step 6d so two chart releases share the node, each with a ceiling of 8, and the load client can start at a sandbox offset.
@wscurran wscurran added the area: e2e End-to-end tests, nightly failures, or validation infrastructure label Nov 3, 2026
@wscurran wscurran added area: inference Inference routing, serving, model selection, or outputs area: networking DNS, proxy, TLS, ports, host aliases, or connectivity area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery labels Nov 3, 2026
cv added a commit that referenced this pull request Nov 4, 2026
…odel Service (#14184)

<!-- SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION &
AFFILIATES. All rights reserved. -->
<!-- SPDX-License-Identifier: Apache-2.0 -->

## Failure

The repository has no example of many agent sandboxes sharing a GPU
inference Service that Kubernetes autoscales.
The [kubernetes-gpu-autoscaling
chart](https://github.com/NVIDIA/nemoclaw-community/tree/ae756c28bda501eb9c4b7ec26d977e6f0c6fd2fc/examples/recipes/nvidia/kubernetes-gpu-autoscaling)
in NVIDIA/nemoclaw-community runs that Service, but nothing shows how to
point a NemoClaw deployment at it, or which key and model the sandboxes
need.

## Decision

Add `examples/kubernetes/gpu-autoscaling/` with one configuration and a
README:

- `openclaw-ollama.yaml`: a managed Kubernetes gateway and two OpenClaw
sandboxes, `user-0000` and `user-0001`, sharing one route to the chart's
metrics proxy Service,
`http://nemoclaw-gpu-metrics-proxy.nemoclaw-gpu.svc.cluster.local:8081/v1`,
with the chart's key from `GPU_INFERENCE_API_KEY`. It adapts
`openclaw-ollama.yaml` from #14009 at `ac69c22`.
- `README.md`: installs the chart at nemoclaw-community `ae756c28bd`
with its `install-hpa.sh`, finds the Service and reads the key from its
Secret, applies the file, invokes an agent through the OpenShell CLI
with the `oidc` profile as `docs/kubernetes.md` and `docs/agents.md`
describe, and removes everything. A table lists what to change for
Hermes with vLLM and Deep Agents with NIM, instead of two more
near-identical files.

The chart stays in nemoclaw-community: running the model server is the
platform's work ([upstream
boundaries](https://github.com/NVIDIA/NemoClaw/blob/v1/docs/design/scope.md#upstream-boundaries)),
and NemoClaw reaches it as [a model server in the
cluster](https://github.com/NVIDIA/NemoClaw/blob/v1/docs/kubernetes.md#use-a-model-server-in-the-cluster).
Because only `NemoClawConfig` YAML is added under `examples/`, the
existing example tests cover the file with no Rust changes.

Not included:

- A load client that sends prompts to many agents. It needs a supported
way to reach agents on a managed gateway; the `development` profile
gives the operator no gateway access, and the `oidc` path has no
automated coverage. It is a follow-up.
- The README sends agents to the chart's metrics proxy Service, so
requests skip the chart's Envoy LeastRequest route; the README says so.

## Validation

- `cargo ci` on the committed branch: passed; test ran 1,820 tests and
lifecycle 101.
- `cargo run --locked -p nemoclaw-build -- fern check`: 0 errors.
- `cargo test -p nemoclaw-onboarding gpu_autoscaling` and `cargo test -p
nemoclaw-sdk --test integration example`: passed, including the new
file.
- README walk on a local kind cluster (kind v0.33.0,
`kindest/node:v1.37.0`, Agent Sandbox 1.0.3, linux/arm64 host, no GPU),
with resources named `pairing-walk*` that I created and deleted:
- Installed the chart from nemoclaw-community `ae756c28bd` with `helm
upgrade --install` instead of `install-hpa.sh`, which requires GPU nodes
and DCGM. Overrides: Ollama runtime with `qwen3:0.6b`, no GPU request,
node selector or tolerations, Envoy and ServiceMonitor off, no HPA, and
arm64-capable image digests for Ollama 0.40.11 and
`node:22-bookworm-slim` (the chart pins amd64-only digests). The pod
reached `2/2`.
- Read the Service and key with the README's commands; a request without
the key got 401, and a chat completion with it returned a reply from
`qwen3:0.6b`.
- Built `openclaw` for linux/arm64, pushed it to a registry on the kind
network, exported its metadata, copied the file, and set the UID,
context, image digest and, for the CPU model, `model: qwen3:0.6b`.
- `nemoclaw plan` and `nemoclaw apply` with the `development` profile:
apply completed in 56 s; both sandbox pods were `1/1 Running`, and the
state recorded a running runtime for each. The README's `jq` filter
returned `user-0000`'s runtime ID.
- `nemoclaw plan --destroy` and `nemoclaw destroy`: completed, keeping
only the gateway storage. I ran `helm uninstall` before destroy by
mistake; destroy still succeeded.
- Not run: invoking an agent. It needs the `oidc` profile, an OIDC
issuer and a browser sign-in for the OpenShell CLI. So this walk doesn't
show an agent reaching the Service, and the README says to invoke one to
check inference.
- Not run: `install-hpa.sh`, autoscaling, vLLM and NIM. They need GPUs,
and NIM needs an NGC key.
- `cargo ci live-kind` and `live-docker`: not run; the change adds no
image or Kubernetes code.

Co-authored-by: maggiezha <[email protected]>
cv added a commit that referenced this pull request Nov 4, 2026
…4192)

## Failure

The GPU autoscaling example has no way to load the chart's GPUs through
the agents, which is what makes its autoscaler scale.
#14009 had load clients, but they sent each prompt with `kubectl exec`
into the sandbox pods, around the gateway's authentication, and read pod
names and runtime IDs from NemoClaw's `terraform.tfstate`.
With the `development` profile that example uses, nobody but NemoClaw
can authenticate to the gateway, so no supported client could reach the
agents.

## Decision

Follows #14191 (merged), on which this was stacked.

- `examples/kubernetes/gpu-autoscaling/load.sh`, a Bash script with the
OpenShell CLI, `curl` and `jq`. It reads `nemoclaw apply -o json` and
sends `PROMPTS` prompts across the agents, at most `CONCURRENCY` at a
time through `xargs -P`, then prints how many it sent and how many
replied, the median, 95th-percentile and longest latency overall and per
sandbox, up to 10 failures, and one reply per sandbox. It exits nonzero
if any request failed. Each sandbox takes one of the two paths that need
no state files or `kubectl exec`:
- **Hermes's API server**, when apply lists an `api` interface and an
`api` service URL for the sandbox: OpenAI chat completions to
`serviceUrls.SANDBOX.api`, through the gateway's port forward and with
its client certificate. The script reads the interface token once, with
`openshell sandbox exec … cat` and the reported `tokenPath`, into a
private temporary file.
- **`fabric-agent-ctl invoke`** for any other sandbox, such as OpenClaw
or Deep Agents, through `openshell sandbox exec` with
`agents.SANDBOX.runtimeId` (#14186).
- `two-runtimes.yaml`: a Hermes sandbox on the chart's vLLM release and
an OpenClaw sandbox on its Ollama release, the two that
`install-two-runtimes.sh` installs (#14191). It uses the `oidc` profile,
and declares Hermes's `api` interface with a `serviceExposures` entry
using `BEARER_PASSTHROUGH`, because OpenShell's default `STRIP` drops
the token Hermes checks. Its Envoy Service names are the ones Envoy
Gateway v1.8.3 created for those Gateways on kind; it shortens a
Gateway's name to 48 characters before the hash.
- `README.md`: **Drive Load Through the Agents**, with the apply and run
commands, the variables, and the limits: the gateway's one CPU for
`sandbox exec`, Fabric's one invocation at a time per runtime, Hermes's
10 concurrent runs per sandbox, what a service URL skips, and that the
CLI doesn't renew a client-credentials token (ai-openshell/openshell#4287).

From #14009's `e2e-fabric-load-test.py` and client scripts, this keeps
the prompts, the per-request timeout, the success check on
`result.status` and `result.output.response`, and per-sandbox counts. It
leaves out the HPA polling and the stop-at-ceiling logic, which belong
to the chart and `kubectl get hpa --watch`; the OpenClaw tool pinning,
which edited Fabric's generated configuration inside the sandbox; and
the timeline and CSV output.

## Validation

- `cargo ci` on `c6a581a9cf`: all selected steps passed in 135 s; test
ran 1,827 tests and lifecycle 101. `cargo test -p nemoclaw-onboarding
two_runtimes` ran the new file's onboarding journey.
- `shellcheck` 0.11 (`koalaman/shellcheck:stable`) on `load.sh`: no
findings.
- Live run on a local kind cluster (kind v0.33.0,
`kindest/node:v1.37.0`, Agent Sandbox 1.0.3, linux/arm64, no GPU), with
resources I created and removed afterwards:
- **Model:** the chart from nemoclaw-community `cb46db83ab` installed
with `helm`, with Ollama and `qwen3:0.6b` on CPU, no GPU request or node
selector, no ServiceMonitor or HPA, arm64 digests for Ollama 0.40.11 and
`node:22-bookworm-slim`, behind Envoy Gateway v1.8.3. Both sandboxes
used its one Envoy Service, with `model: qwen3:0.6b`.
- **Issuer:** Keycloak 26.4 in the cluster, at `https://<kind node
IP>:30443/realms/openshell` with a test CA, so that the gateway pod and
the host see the same issuer URL, with a confidential client whose
service account has the admin role in a `roles` claim and audience
`openshell`. The kind HCL cases' issuer serves only discovery and keys,
with no token endpoint, so the OpenShell CLI can't sign in through it.
- **Deployment:** `two-runtimes.yaml` with the context, issuer,
endpoints, model and image digests replaced, and `openclaw` and `hermes`
built for linux/arm64 and pushed to a registry on the kind network.
`nemoclaw apply -o json` with the bundle from this branch succeeded, and
reported `serviceUrls.user-0000.api` as
`https://nc-…--user-0000--api.openshell.localhost:8080/`, both runtime
IDs under `agents`, and the Hermes token path under `interfaces`.
- **CLI:** the port forward and client certificate from
`docs/kubernetes.md`, then `openshell gateway add … --oidc-client-id`
with `OPENSHELL_OIDC_CLIENT_SECRET` (OpenShell 0.1.6): `Authenticated
via client credentials`; `openshell status` showed `Authenticated
(OIDC)`.
  - **Load:** `PROMPTS=12 CONCURRENCY=4 load.sh apply.json`:

    ```text
    Sending 12 prompts to 2 sandboxes, at most 4 at a time:
user-0000: Hermes API at
https://nc-…--user-0000--api.openshell.localhost:8080/
user-0001: fabric-agent-ctl invoke, runtime runtime-1793794887745-82-2

    Sent 12 prompts in 238 s: 12 replied, 0 failed.
    Latency of replies: p50 51.9 s, p95 156 s, max 156 s.

      user-0000 (api): 6/6 replied; p50 16.9 s, p95 87.6 s, max 87.6 s
      user-0001 (invoke): 6/6 replied; p50 80.7 s, p95 156 s, max 156 s

reply #1 user-0000: A Kubernetes HorizontalPodAutoscaler is a service
that automatically scales its pods based on metrics.
reply #2 user-0001: The current system state shows no active exec
sessions or subagents, indicating no ongoing operations are in progress.
To proceed, please check your system or c
    ```

An earlier run of 8 prompts also got 8 replies. OpenClaw's replies don't
answer the prompts, likely because of `qwen3:0.6b` with OpenClaw's
tools; each invocation still reported `succeeded` with a response.
- **Failures:** with `TIMEOUT=5`, both requests were reported as failed
(`curl: (28) Operation timed out` and `timed out after 5 s`), and the
script exited 1.
- Not run: GPUs, autoscaling, vLLM, NIM, and Deep Agents. The Deep
Agents path is the same `fabric-agent-ctl invoke` command as OpenClaw's.
- Deferred to CI: `cargo ci live-kind` and `live-docker`; the change
adds no image or Kubernetes code.

Co-authored-by: maggiezha <[email protected]>
@cv

cv commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Closing in favor of smaller changes that together cover this recipe:

The chart, its scripts, and the hardware load tests stay in nemoclaw-community, so this repository keeps only the NemoClaw side. Thanks for the port; the pairing files and the client build on it.

@cv cv closed this Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: docs Documentation, examples, guides, or docs build area: e2e End-to-end tests, nightly failures, or validation infrastructure area: inference Inference routing, serving, model selection, or outputs area: networking DNS, proxy, TLS, ports, host aliases, or connectivity area: observability Logging, metrics, tracing, diagnostics, or debug output area: performance Latency, throughput, resource use, benchmarks, or scaling area: providers Inference provider integrations and provider behavior area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery area: security Security controls, permissions, secrets, or hardening feature PR adds or expands user-visible functionality integration: dcode LangChain Deep Code integration behavior integration: hermes Hermes integration behavior integration: openclaw OpenClaw integration behavior platform: k8s Affects Kubernetes deployments provider: nvidia NVIDIA inference endpoint, NIM, or NVIDIA provider behavior provider: ollama Ollama local model provider behavior provider: vllm vLLM local or hosted provider behavior v1 NemoClaw v1 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants