Skip to content

fix(k8s): deploy-stack warns about GPU nodes no Ollama tier accepts, k8s/README.md documents GPU placement, and the gateway's ServiceMonitor moves to the llm stack #1367

Closed

Description

@dan-petty

Refreshed plan (2026-10-17, unblocking review)

This section supersedes any text below that conflicts with it.

Decisions

Scope

Delivery

  1. PR 1 (M), "Part of fix(k8s): deploy-stack warns about GPU nodes no Ollama tier accepts, k8s/README.md documents GPU placement, and the gateway's ServiceMonitor moves to the llm stack #1367": the node read and its warnings, the README's GPU placement section, and the removal of the 36 commented-out lines. It can start now.
  2. PR 2 (S, or M if it adds the shared step), "Closes fix(k8s): deploy-stack warns about GPU nodes no Ollama tier accepts, k8s/README.md documents GPU placement, and the gateway's ServiceMonitor moves to the llm stack #1367": the ServiceMonitor move, SkipDryRunOnMissingResource=true on the llm Application, the README's dashboards row and file-tree line, and the tests that now read the new file.
  • Each PR adds changelog.d/1367.md or extends it.

Acceptance criteria (these replace the body's "deploy-stack applies the monitor after the Helm releases" bullet; every other body criterion stands)

Current references (checked at 3dd7fa6; these replace the body's line numbers from 910b823)

  • Reachability check: src/devops_cli/commands/k8s/stack_lifecycle.py:1051-1052. Argo CD early return: :1054-1063. PR 1's node read goes between them.
  • Step 8's node read: stack_lifecycle.py:1083-1088, which calls _get_unready_nodes at src/devops_cli/commands/k8s/cluster_runtime.py:174-200.
  • Helm releases (step 9): stack_lifecycle.py:1090-1094. Step 10: :1096. The shared step goes between them.
  • _MANIFESTS_BY_STACK["llm"]: stack_lifecycle.py:181-190. _KUSTOMIZATIONS_BY_STACK: :210-212, whose comment at :206-209 says it applies before any Secret or chart.
  • Apply helpers: _apply_manifest_files at stack_lifecycle.py:597 and _apply_kustomizations at :899-902.
  • teardown-stack: dry run at stack_lifecycle.py:1199-1216, manifest deletes at :1233-1239, Helm uninstalls at :1251-1257.
  • The gateway's ServiceMonitor in extraObjects: k8s/monitoring/k8s-monitoring-values.yaml:307-323. The CRD chart's comment: k8s/monitoring/prometheus-operator-crds-values.yaml:5-9.
  • The rule against chart-CRD kinds in a pre-chart kustomization: k8s/monitoring/kustomization.yaml:6-8.
  • qdrant's ServiceMonitor: k8s/llm/values-qdrant.yaml:74-75. Stack order for all: src/devops_cli/commands/k8s/networking.py:70-71.
  • feat(llm): add speed-tier service aliases, align 48gib slow routing weights and bump max loaded models #1042's live gpu.architecture selectors: k8s/llm/profiles/ollama-profiles.yaml:207-209 (24gib), :498-500 (48gib) and :644-646 (48gib-slow).
  • The commented-out blocks: ollama-profiles.yaml:60-65, :349-354, :792-797, :939-944, :1086-1091 and :1243-1248.
  • README: GPU placement at k8s/README.md:125-126, the gateway's dashboards row at :189, the gateway/ file-tree line at :667.
  • The gateway's alias Services: k8s/llm/gateway/configmap.yaml:18, :24, :30 and :53. The perimeter: k8s/llm/gateway/networkpolicy.yaml:6.
  • k8s/argocd/apps/llm.yaml:17-26 has no syncOptions. k8s/argocd/apps/k8s-monitoring.yaml:33-34 sets SkipDryRunOnMissingResource=true.
  • k8s/llm/kustomization.yaml:4-16.
  • Tests: tests/test_k8s.py:370, tests/test_stack_dashboards.py:61-68, tests/test_llm_pool_metrics.py:36 and tests/test_architectural_invariants.py:1410.

Dependencies and order


Problem

This issue was split from #795 on 2026-10-08, when the owner reduced #795 to the gateway policy. Everything below was checked against release/v0.2.29 at 910b823.

Ollama tiers schedule only on labelled nodes, and deploy-stack does not notice.

  • The nine DaemonSets in k8s/llm/profiles/ollama-profiles.yaml require nvidia.com/gpu.total-vram-gib In [...].
  • feat(llm): add speed-tier service aliases, align 48gib slow routing weights and bump max loaded models #1042 also requires nvidia.com/gpu.architecture In [...] on three tiers: ollama-24gib (:148-150), ollama-48gib (:351-353) and ollama-48gib-slow (:453-455). Those selectors stay, per option 1 of the owner's decision on fix(k8s): deploy-stack applies the llm gateway policy and narrows its egress #795.
  • GPU Feature Discovery labels per-GPU memory and the GPU count, not a total.
  • The cluster's node-provisioning automation lives outside this repository. It sets nvidia.com/gpu.present and nvidia.com/gpu.architecture on every GPU node. It sets nvidia.com/gpu.total-vram-gib only on nodes with more than one GPU, rounded to the nearest whole GiB. So a single-GPU node never gets the label, and a multi-GPU total may come out as a value that no tier accepts.
  • When no Ollama pod schedules on a node, the gateway routes to that tier fail. deploy-stack does not report it.
  • deploy-stack's only node read, _get_unready_nodes (src/devops_cli/commands/k8s/cluster_runtime.py:174-200), returns [] on every failure. It also runs at step 8 (src/devops_cli/commands/k8s/stack_lifecycle.py:1069), after the Argo CD early return (:1040-1050). A warning placed there would never print on an Argo CD-managed cluster.

The README's GPU placement section is incomplete and partly wrong. k8s/README.md:129-132 says each tier is one DaemonSet scheduled by total-vram-gib. It does not say:

It also says the gateway reaches each tier through ollama-<n>gib. The gateway's ConfigMap actually names the alias Services ollama-16gib-fast, ollama-48gib-fast, ollama-48gib-slow and ollama-64gib-standard.

Six DaemonSets keep dead selector blocks. ollama-16gib, ollama-32gib, ollama-64gib, ollama-72gib, ollama-96gib and ollama-128gib each carry a six-line commented-out gpu.architecture/gpu.family block (for example ollama-profiles.yaml:45-50), 36 lines in all. They are left over from the vLLM/Ollama split that #734 removed.

The infra stack owns the gateway's ServiceMonitor. extraObjects in k8s/monitoring/k8s-monitoring-values.yaml:239-255 renders it, so the k8s-monitoring release owns it. That causes two problems:

  • teardown-stack --stack infra removes the gateway's scrape while the gateway keeps running.
  • After teardown-stack --stack llm deletes the namespace, deploy-stack --stack llm does not recreate the scrape.

Listing the file in _MANIFESTS_BY_STACK["llm"] would not be enough, because deploy-stack applies native manifests (step 7) before every Helm release (step 9), prometheus-operator-crds included:

  • On a fresh --stack all, the ServiceMonitor CRD does not exist yet when the manifest is applied.
  • On an existing cluster, the k8s-monitoring upgrade deletes the adopted object in the same run.

Two more gaps:

  • test_prometheus_operator_crds_install_before_every_service_monitor (tests/test_k8s.py) checks only Helm values.
  • k8s/argocd/apps/llm.yaml has no SkipDryRunOnMissingResource=true, which the k8s-monitoring Application sets.

Acceptance criteria

GPU placement:

  • When llm is selected, deploy-stack reads the nodes once, right after the reachability check and before the Argo CD early return.
    • It reads kubectl get nodes -o json through a shared reader that reports failure. _get_unready_nodes uses the same items.
    • A GPU node is one with nvidia.com/gpu capacity above zero, or labelled nvidia.com/gpu.present=true.
    • It warns about every GPU node that no tier accepts: total-vram-gib is missing or not accepted, or, for the split tiers, gpu.architecture is outside the accepted values. Each warning names the node and the label, and gives kubectl label node <node> nvidia.com/gpu.total-vram-gib=<N>Gi.
    • If no node satisfies any tier, it also warns that no Ollama pod will schedule.
    • If the read fails, it says it could not check the labels.
    • In every case the deploy continues and exits 0.
  • The accepted values are read from the required matchExpressions of each llm.devops.io/provider: ollama DaemonSet in ollama-profiles.yaml, never repeated in code. A guard test fails on any operator other than In.
    • Label keys and the GPU predicate's keys live in src/devops_cli/config/constants.py.
    • Warning text lives in MESSAGES.k8s.
  • Offline tests patch runtime._run_cmd for seven cases: a labelled GPU node (no warning), an unlabelled GPU node, a value outside every tier, a node without GPUs (no warning), an architecture mismatch, no node matching any tier, and a failed read.
    • One case runs on the Argo CD-managed path.
    • A deploy-stack --stack llm --dry-run test asserts zero _run_cmd and subprocess calls.
  • The GPU placement section of k8s/README.md covers:
    • one DaemonSet per total-VRAM tier, behind the ollama-<n>gib Services, plus the -fast, -slow and -standard aliases the gateway uses;
    • what sets the labels (the node-provisioning automation, or kubectl label node by hand), and how the value is worked out, consistent with that automation;
    • nvidia.com/gpu.present;
    • each tier's accepted total-vram-gib values, and the gpu.architecture values for 24gib, 48gib and 48gib-slow;
    • the deploy-stack warning;
    • that deploy-stack (or Argo CD's llm Application) applies llm-gateway-perimeter, and what it admits.
  • The 36 commented-out lines are removed, and feat(llm): add speed-tier service aliases, align 48gib slow routing weights and bump max loaded models #1042's three live gpu.architecture selectors stay. Both of these print nothing:
    • rg -n '^\s*#.*(gpu\.(family|architecture)|operator:|values:)' k8s/llm/profiles/ollama-profiles.yaml
    • rg -n 'gpu\.family' k8s/llm k8s/README.md

ServiceMonitor (#1128's last step):

  • The ServiceMonitor moves to k8s/llm/gateway/servicemonitor.yaml, listed in k8s/llm/kustomization.yaml. extraObjects is deleted from k8s-monitoring-values.yaml. These are updated to match:
    • the comment in k8s/monitoring/prometheus-operator-crds-values.yaml:5-8;
    • the gateway row of the README's dashboards table;
    • the gateway/ line of the README's file tree.
  • deploy-stack applies the monitor after the Helm releases, teardown-stack deletes it, and the dry run lists it.
    • test_prometheus_operator_crds_install_before_every_service_monitor also covers deploy-stack's manifest files.
    • The manifest-exists invariant in tests/test_architectural_invariants.py covers any new manifest list.
  • k8s/argocd/apps/llm.yaml gains SkipDryRunOnMissingResource=true.
  • tests/test_llm_pool_metrics.py and tests/test_stack_dashboards.py::_gateway_monitored read the new file. prometheusOperatorObjects stays enabled.

General:

  • Tests touch no cluster, DNS or network, and each test's call phase stays under 1 s.
  • changelog.d/<n>.md records the change. CHANGELOG.md and docs/ROADMAP.md are not edited.
  • uv run devops ci passes.
  • Pending a person: after the deploy (Argo CD's sync of the merged revision, or devops k8s deploy-stack --stack llm on a cluster without Argo CD):
    • devops k8s deploy-stack --stack llm warns only about GPU nodes that kubectl get nodes -L nvidia.com/gpu.total-vram-gib,nvidia.com/gpu.architecture shows no tier accepts.
    • up{job="llm-gateway"} == 1 after deploy-stack --stack llm alone, on a cluster that already runs the infra stack.
    • helm get manifest k8s-monitoring -n monitoring | grep -c ServiceMonitor prints 0.
    • On a cluster without Argo CD, the one-time order is infra first, then llm.

Key questions

  1. One item or two? The owner grouped all four parts here on 2026-10-08. The ServiceMonitor move shares no file with the placement work and is refactor(k8s): the monitoring stack runs on k8s-monitoring and chart features, with no duplicate collection, dead defaults or leftovers #1128's last step. Proposed: refinement may split it into its own refactor(k8s): the monitoring stack runs on k8s-monitoring and chart features, with no duplicate collection, dead defaults or leftovers #1128 child if the item exceeds size M.
  2. Which formula does the README document? The node-provisioning automation rounds to whole GiB and labels only multi-GPU nodes, while the tiers accept multiples of 4 GiB. Proposed: document each tier's accepted values and the kubectl label node command, and record the single-GPU and rounding behaviour as a change for the provisioning automation, tracked where it lives.
  3. Warn or fail? Warn (proposed). A cluster with no usable GPU label still gets Open WebUI, Qdrant, Valkey and the gateway, and the other selected stacks deploy in the same run.
  4. Keep the label key under nvidia.com/? Yes (proposed). A rename would mean relabelling every live node at rollout; if wanted, it is a separate item.
  5. Priority? Inherited from fix(k8s): deploy-stack applies the llm gateway policy and narrows its egress #795's grooming: on a fresh cluster or a rebuilt node, no Ollama pod schedules. The roadmap tooling may re-rank it.

Strategic alignment


Split from #795 by the owner's scope decision of 2026-10-08 (borrow reason: split). Filed directly because local intake could not reach the model gateway; the roadmap service's intake sets Priority, Value and Effort.

Activity

  1. added
    type/bug
    scope/k8s
    source/agent
    on Oct 8, 2026
  2. dan-petty-bot commented on Oct 8, 2026

    @dan-petty-bot
    Collaborator

    Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.

    • Priority: P2-Medium. Users get silent gateway-routing failures and lose monitoring on llm-stack redeploy, but the cluster still runs and no data is lost.
    • Value: Medium. Fixes a silent operational failure mode and a monitoring gap that affect every operator deploying the llm stack on GPU nodes.
    • Effort: Medium. Requires a new shared node-reader in deploy-stack, a warning path before the Argo CD early return, README corrections, removal of 36 dead lines, moving the ServiceMonitor to the llm manifest list with CRD-ordering handling, and test updates
  3. dan-petty commented on Oct 8, 2026

    @dan-petty
    OwnerAuthor

    Linked: #1323 moves the deploy-stack code this item adds to, and #1391 needs the same post-Helm step; whichever lands first adds it. Found by the 2026-10-08 backlog review.

  4. added this to the v0.2.38 milestone on Oct 21, 2026
  5. added a commit that references this issue on Oct 21, 2026
    81d8e0a
  6. dan-petty commented on Oct 21, 2026

    @dan-petty
    OwnerAuthor

    What changed

    #1796, merged into release/v0.2.38 as 81d8e0a.

    deploy-stack --stack llm warns about every GPU node no Ollama tier accepts. It closes #1367: its ServiceMonitor half was delivered by #1794 (Part 8 of #1128).

    10 file(s) changed.

    How it was verified

    Check runs at 8991b2e:

    • Prune PR DevContainer Images: pass
    • Audit Defect PR Hardening: skipping
    • zizmor: pass
    • devops-cli: pass
    • bandit: pass
    • CodeQL: pass
    • Rule Pack Tests: pass
    • Fail-to-Pass Self-Check: pass
    • Tests & Coverage: pass
    • Fail-to-Pass Check: pass
    • Static Analysis: pass
    • Changed-Test Independence: pass
    • Analyze (python): pass
    • Analyze (actions): pass
    • DevContainer Image: skipping
    • Service Image: skipping
    • Dependency Freshness: skipping

    Acceptance Criteria of docs/agent/tasks/task-1367-gpu-placement-warning.md:

    No Acceptance Criteria section.

  7. added 3 commits that reference this issue on Oct 21, 2026
    1a8b26c
    f92399e
    70e775f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope/k8ssource/agenttype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions