Skip to content

feat(kubernetes): run managed vLLM and Ollama on managed cluster gateways - #13489

Closed
gaveezy wants to merge 6 commits into
feat/runtime-ready-holdfrom
feat/kubernetes-managed-model-services
Closed

gaveezy wants to merge 6 commits into
feat/runtime-ready-holdfrom
feat/kubernetes-managed-model-services

Conversation

@gaveezy

@gaveezy gaveezy commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Replaces #13062, rebuilt on v1's provider model. #13062 was a SDK-side Kubernetes reconciler stacked on #13061; its branch split/7-cluster-model-services stays at 9d3deaf. It was parked after #13131, and #13061 was closed under docs/design/scope.md's upstream-boundary rule. This PR keeps none of that reconciler.

Stacked on #13487 (feat/runtime-ready-hold), whose commit is this branch's first; it targets that branch and moves to v1 once #13487 merges. Merging still waits on the maintainers' answer in #12641 about NemoClaw placing model servers on clusters.

What it does

A managed vLLM or Ollama service beside a managed Kubernetes or OpenShift gateway compiles the way a Docker service does: data.vllm_runtime or data.ollama_runtime describes the server, and an upstream provider runs it. Here the provider is the bundled hashicorp/kubernetes 3.3.0, which Kubernetes then runs, schedules and restarts.

Object Purpose
kubernetes_persistent_volume_claim_v1 The model volume: prevent_destroy, kept on destroy, imported again on reapply when its owner label matches
kubernetes_network_policy_v1 Ingress only from OpenShell supervisors, on the serving port
kubernetes_deployment_v1 One replica with Recreate, running launch.*. Requests from kubernetes, limits from container, one nvidia.com/gpu. Readiness probe launch.ready_command, and NEMOCLAW_RUNTIME_ON_STOP=hold
kubernetes_service_v1 ClusterIP; serviceRef resolves to http://<name>.<namespace>.svc.cluster.local:<port>/v1

Keys: an authenticated vLLM server reads kubernetes.keySecret, a Secret the platform owns. The provider's credential names the same key where nemoclaw runs, as #13063's in-cluster providers do.

The upstream-boundary questions

  1. Does an upstream component already provide it? Yes, and this relies on it. Kubernetes owns placement, restarts, rollout, readiness probes, limits and image pulls. The hashicorp/kubernetes provider owns the object lifecycle. The platform's secret store holds keys. NemoClaw adds only the mapping from configuration to objects.
  2. Is NemoClaw the right place? It declares the objects and checks its own bindings. It doesn't read readiness from the OpenTofu host: the kubelet runs the probe in the container. The one cluster read is the claim-ownership check before a reapply, which is metadata only.
  3. Would an experienced OpenTofu user expect it? Yes. These are the provider's ordinary resources, and the generated graph is the HCL they would write themselves, as docs/provider.md shows for Docker.
  4. Does it need a patch, a workaround or a reimplementation? No. It uses documented provider inputs and documented Kubernetes fields. The runtime's readiness command and hold-after-protective-stop come in feat(runtime): add a readiness command and hold after protective stops #13487, which covers the gap between scope.md's "no automatic restart loops" and a Deployment's restart policy.
  5. Which promise does it serve? Mapping desired state to resources, retaining data on destroy, ownership checks before reuse, and memory protection for managed model services.

Differences from #13062 (9d3deaf)

  • Dropped:
  • Kept: the cluster schema rules, the Docker-preservation skip, the NetworkPolicy warning, and the fixtures (now routed by serviceRef).
  • New:
    • the bundled Kubernetes provider (first commit);
    • keySecret;
    • the cluster Preserve check;
    • claim import on reapply;
    • examples examples/kubernetes/managed-{vllm,ollama}.yaml;
    • docs (kubernetes.md "Run a Managed Model Service").

Validation

  • cargo ci on linux_arm64: see the commit message for the numbers.
  • New lifecycle test cluster_models: both fixtures' objects pass init, validate and plan with the bundled Kubernetes, vLLM and Ollama providers against an unreachable cluster.

Not covered (deferred)

  • Create, update and delete against a real API server. The provider sends protobuf, so the JSON in-memory API can't stand in; this needs a kind job with a stand-in runtime image and a fake nvidia.com/gpu.
  • Real-GPU qualification, OpenShift SCC admission, and NetworkPolicy enforcement.
  • MIG or multiple GPUs per service.
  • Failing fast on crash loops: today they wait out the 9 h rollout deadline, which is documented.
  • Runtime image builds and cargo images qualify for the readiness symlink, which need Docker.

🤖 Generated with Claude Code

gaveezy and others added 2 commits October 19, 2026 13:09
Managed model services on a Kubernetes gateway will be placed with
Kubernetes' own objects (claims, Deployments, Services and
NetworkPolicies), the way Docker services are placed with the Docker
provider. This commit only bundles the provider; nothing declares it
yet.

- versions.json pins hashicorp/kubernetes 3.3.0 for all five platforms.
  The checksums come from the release's SHA256SUMS, whose signature was
  verified against HashiCorp's signing key fingerprint
  C874011F0AB405110D02105534365D9472D7468F. The source revision is
  a612b9cfce0fd1321cf2d25084b07b8fccd79737.
- The builder installs it like the Helm provider: the exact binary entry
  and the unchanged LICENSE.txt, as
  licenses/kubernetes-provider-LICENSE. The two share one installer.
- The SDK pins the version (`kubernetes::models::PROVIDER_VERSION`), and
  a bundle without the provider or its license is rejected.
- The provider reads `KUBE_*` settings, which processes the SDK starts
  already don't inherit. A test now names them.
- docs/build.md and docs/provider.md list the provider. It is the only
  bundled provider with ephemeral resources and provider functions;
  generated graphs use none.

The bundle grows by about 61 MB per platform.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ways

## Failure

A managed Kubernetes or OpenShift gateway rejects `spec.services`, so a
cluster deployment needs a model server deployed by hand (#13063). The
earlier attempt, #13061 and #13062 at 9d3deaf, reconciled Pods through
the SDK with its own placement, readiness over exec and generated keys.
It was closed under docs/design/scope.md's upstream-boundary rule.

## Decision

Place cluster model services the way Docker services are placed: the
runtime contract describes the server, and an upstream provider runs it.
NemoClaw declares the objects; it runs no controller of its own.

- Configuration: a vLLM or Ollama service beside a managed Kubernetes or
  OpenShift gateway needs `kubernetes` settings: requests, `storageGiB`,
  optional `storageClass`, `nodeSelector`, `tolerations` and
  `runtimeClassName`, and for bearer vLLM `keySecret`, a platform Secret
  NemoClaw never reads. Both container limits are required. Docker
  placement, publication, host IPC and the ports OpenShell refuses are
  rejected. External gateways still reject services, and Docker and
  Podman reject `kubernetes`.
- Routing: `serviceRef` resolves to the Service's cluster address. An
  authenticated service's provider names the same key in `credential`,
  as #13063's in-cluster providers do. That credential is accepted only
  there, and the schema keeps rejecting it elsewhere.
- Compile: per service, `data.vllm_runtime` or `data.ollama_runtime`
  plus four `kubernetes_*_v1` objects:
  - a retained claim (`prevent_destroy`, `wait_until_bound = false`);
  - a NetworkPolicy that admits only OpenShell supervisors;
  - a one-replica `Recreate` Deployment running `launch.*` with the
    requests and limits and one `nvidia.com/gpu`. Its readiness probe is
    `launch.ready_command`, and it sets `NEMOCLAW_RUNTIME_ON_STOP=hold`
    (both from the runtime change this builds on);
  - a ClusterIP Service.
  `join` already holds every object until the Deployment's rollout
  completes.
- Safety:
  - `updatePolicy: Preserve` refuses a plan that would replace a serving
    Pod: a delete, or a Pod-template change, unless OpenTofu is
    replacing a tainted Deployment.
  - The claim follows the Docker cache's rules: it is never dropped or
    replaced, and destroy keeps it.
  - A reapply after destroy reads only that claim's metadata and imports
    it when its owner label matches; any other owner stops apply.
  - State bindings flatten the objects to their name, namespace and
    owner.
- The NetworkPolicy warning from #13062 is kept.

## Validation

- New SDK tests:
  - configuration rules and routing (`cluster_service_config`);
  - compiled objects, gating, teardown and escaping
    (`cluster_services_compile`);
  - claim import against the in-memory API;
  - the cluster Preserve matrix, claim retention, state parsing and the
    NetworkPolicy warning.
- New lifecycle test `cluster_models`: both fixtures' objects pass init,
  validate and plan with the bundled Kubernetes, vLLM and Ollama
  providers against a cluster that does not exist. The containers carry
  the contract's entrypoint, port, readiness command and key variable.
- `cargo ci` on linux_arm64 (Rust 1.99.1) passed in 271 s: fmt, clippy,
  build, test (1624 passed, 202 skipped), schema, bundle and lifecycle
  (151 passed, 52 skipped), all within budget. `nemoclaw-build docs
  --check` passed. The authoring journey test now covers 42 single-sandbox
  examples, including the two new managed cluster examples.
- Not run: any real cluster, GPU, OpenShift security constraint or
  NetworkPolicy plugin. The bundled Kubernetes provider sends protobuf,
  so the JSON in-memory API can't exercise create, update or delete;
  that needs the kind suite. docs/limits.md says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@copy-pr-bot

copy-pr-bot Bot commented Oct 19, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@gaveezy gaveezy added provider: ollama Ollama local model provider behavior provider: vllm vLLM local or hosted provider behavior area: providers Inference provider integrations and provider behavior area: security Security controls, permissions, secrets, or hardening platform: k8s Affects Kubernetes deployments labels Oct 19, 2026
gaveezy and others added 4 commits October 19, 2026 17:22
`cluster_models` failed on windows_amd64 because it cleared the
environment before running OpenTofu. Without `SYSTEMROOT` and the other
Windows system variables, the Kubernetes provider failed its go-plugin
handshake. The test now passes those variables on, as the SDK does for
its providers (`process::PLATFORM_VARIABLES`).

It still passes on linux_arm64 against the local bundle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`stage_runtime_sources` ran `cargo package` online, so every call
fetched the crates.io sparse index while holding Cargo's package cache
lock. When the registry stalled on a CI runner, the runtime source
identity test hung past its 24 s limit (run 39286680504,
linux_amd64), and the other tests that take that lock, `cargo tree
--offline` and `cargo generate-lockfile --offline`, waited 14-19 s
behind it.

The workspace lockfile already pins every dependency, so pass
`--offline`: Cargo builds the package's lockfile from the index it has
already cached. Online and offline packaging produce identical files.

The new test points Cargo at an unreachable proxy and stages the
sources. It failed with a registry connection error before this change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rvices' into fix/13489-offline-runtime-package
…ices

The base branch merged v1 up to 0bc2601. Resolutions:

- SecretRef/FileRef split (#13222): `credential` on an inference
  provider is now a `SecretRef`. The cluster key keeps its description
  (the same key as the service's `kubernetes.keySecret`), and
  `InferenceTarget::Service` carries `Option<&SecretRef>`. The authored
  form, `credential: {env: …}`, is unchanged, so the examples and
  fixtures stay as they are.
- context_advisory.rs was removed (#13485). This branch had only
  widened its `InferenceTarget::Service` pattern, so the merge takes the
  deletion and drops the call in `Deployment::run`, keeping the
  NetworkPolicy warning before it.
- Runtime images now build with Bake under image/ (#13507), which
  removed nemoclaw-build's runtime_source.rs and tests/runtime_engine.rs.
  The merge takes both deletions. That also removes 05fb557's
  `--offline` packaging and its test: on Live/Docker runners, archived
  tests ran with a Cargo home that lacked the OpenShell git checkout, so
  offline packaging failed ("you are in the offline mode").
- The authoring journey count is 41: v1 removed one single-sandbox
  example and this branch adds two.
- The schema and configuration reference are regenerated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: providers Inference provider integrations and provider behavior area: security Security controls, permissions, secrets, or hardening platform: k8s Affects Kubernetes deployments provider: ollama Ollama local model provider behavior provider: vllm vLLM local or hosted provider behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant