Skip to content

docs(tutorials): add KAI Scheduler + HAMi-core lab on nvml-mock - #722

Open
maishivamhoo123 wants to merge 3 commits into
Project-HAMi:masterfrom
maishivamhoo123:docs/kai-scheduler-hami-lab
Open

docs(tutorials): add KAI Scheduler + HAMi-core lab on nvml-mock#722
maishivamhoo123 wants to merge 3 commits into
Project-HAMi:masterfrom
maishivamhoo123:docs/kai-scheduler-hami-lab

Conversation

@maishivamhoo123

@maishivamhoo123 maishivamhoo123 commented Aug 5, 2026

Copy link
Copy Markdown
Member

This PR adds a new tutorial lab (Lab 11) that shows how to run NVIDIA KAI Scheduler with HAMi-core memory isolation on a local kind cluster using nvml-mock, so people can try the integration without a real GPU. It builds on the existing nvml-mock lab and walks through installing the NVIDIA device-plugin, KAI Scheduler with the hamicore plugin, queues, and kai-resource-isolator, then verifies whole-GPU scheduling, fractional GPU-memory accounting, and HAMi-core's ld.so.preload injection. It also contains where a fake GPU stops Every command was run and every output is a real capture (KAI v0.17.0, kai-resource-isolator 1.1.0-chart). Includes English and Chinese versions plus the sidebar and overview entries. This docs contain the whole logs which i got during my testing. https://docs.google.com/document/d/1IxAtURfCziGarAyD2avN6b5V3BqpdmwJUTUSBy2Tvxs/edit?usp=sharing

fix :- #721

Summary by CodeRabbit

Summary by CodeRabbit

  • Documentation
    • Added an advanced lab tutorial for configuring and validating KAI Scheduler with HAMi-core and kai-resource-isolator.
    • Covers simulated GPU environments, whole- and shared-GPU scheduling, memory isolation, expected limitations, cleanup, and real-GPU follow-up steps.
    • Added the tutorial to the Labs navigation with an estimated duration of 50 minutes.

@hami-robot
hami-robot Bot requested review from rootsongjc and windsonsea August 5, 2026 03:27
@hami-robot

hami-robot Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: maishivamhoo123
Once this PR has been reviewed and has the lgtm label, please assign archlitchi for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@netlify

netlify Bot commented Aug 5, 2026

Copy link
Copy Markdown

Deploy Preview for project-hami ready!

Name Link
🔨 Latest commit c9a5f2b
🔍 Latest deploy log https://app.netlify.com/projects/project-hami/deploys/6a76eb007f2ccc00078a2571
😎 Deploy Preview https://deploy-preview-722--project-hami.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds an advanced tutorial for installing and validating KAI Scheduler, HAMi-core, and kai-resource-isolator on an nvml-mock-backed kind cluster. It covers whole-GPU scheduling, shared-GPU injection, NVML limitations, cleanup, follow-up links, and sidebar registration.

Changes

KAI Scheduler and HAMi lab

Layer / File(s) Summary
Cluster and simulated GPU setup
tutorials/labs/kai-scheduler-hami.md, i18n/zh/.../labs/kai-scheduler-hami.md, sidebars-tutorials.js
Adds prerequisites, kind cluster creation, nvml-mock deployment, device-plugin setup, simulated GPU labels, and Labs sidebar registration.
Scheduler and isolator configuration
tutorials/labs/kai-scheduler-hami.md, i18n/zh/.../labs/kai-scheduler-hami.md
Documents KAI GPU-sharing configuration, hamicore support, queue creation, kai-resource-isolator installation, webhook checks, and the nvidia RuntimeClass.
GPU scheduling and validation boundaries
tutorials/labs/kai-scheduler-hami.md, i18n/zh/.../labs/kai-scheduler-hami.md
Adds whole-GPU and shared-GPU Pod checks, HAMi-core injection verification, reservation-Pod diagnostics, and evidence tables.
Cleanup and follow-up
tutorials/labs/kai-scheduler-hami.md, i18n/zh/.../labs/kai-scheduler-hami.md
Adds resource cleanup commands and links for real-GPU validation and implementation references.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant kind
  participant nvmlMock
  participant devicePlugin
  participant KAIScheduler
  participant kaiResourceIsolator
  participant TestPod
  kind->>nvmlMock: Deploy simulated GPU support
  nvmlMock->>devicePlugin: Provide GPU discovery
  devicePlugin->>KAIScheduler: Publish allocatable GPU resources
  TestPod->>KAIScheduler: Request whole GPU or gpu-memory
  KAIScheduler->>TestPod: Bind Pod to a GPU allocation
  kaiResourceIsolator->>TestPod: Inject HAMi-core configuration
  TestPod-->>TestPod: Report Running or NVML library failure
Loading

Possibly related issues

Possibly related PRs

Suggested labels: kind/documentation

Suggested reviewers: rootsongjc, windsonsea

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the new KAI Scheduler and HAMi-core tutorial using nvml-mock.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot added the kind/documentation Improvements or additions to documentation label Aug 5, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (2)
tutorials/labs/kai-scheduler-hami.md (2)

49-60: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Pin the Kubernetes version used by the lab.

The prerequisites constrain kind and kubectl, but kind create cluster leaves the Kubernetes node image implicit. Different installations can produce different cluster versions and captured outputs. Add a tested kindest/node image or document the exact Kubernetes version.

  • tutorials/labs/kai-scheduler-hami.md#L49-L60: pin the English lab cluster version.
  • i18n/zh/docusaurus-plugin-content-docs-tutorials/current/labs/kai-scheduler-hami.md#L50-L61: apply the same pin in the Chinese lab.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tutorials/labs/kai-scheduler-hami.md` around lines 49 - 60, Pin the kind
Kubernetes node image in the cluster creation command to a tested kindest/node
version, replacing the implicit default. Apply the same pin to the corresponding
command in tutorials/labs/kai-scheduler-hami.md (lines 49-60) and
i18n/zh/docusaurus-plugin-content-docs-tutorials/current/labs/kai-scheduler-hami.md
(lines 50-61); keep the existing NODE_NAME assignment unchanged.

128-149: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Do not mutate or delete KAI's generated default queues.

KAI v0.17.0 creates default-parent-queue and default-queue during installation. This block creates another root, reparents the generated leaf, and later deletes default-queue. Use the generated queues, or create unique lab queues and clean up only those resources. (github.com)

  • tutorials/labs/kai-scheduler-hami.md#L128-L149: remove the manual default-queue mutation or use unique names.
  • tutorials/labs/kai-scheduler-hami.md#L320-L320: do not delete KAI's generated queue in cleanup.
  • i18n/zh/docusaurus-plugin-content-docs-tutorials/current/labs/kai-scheduler-hami.md#L129-L150: apply the same queue change.
  • i18n/zh/docusaurus-plugin-content-docs-tutorials/current/labs/kai-scheduler-hami.md#L321-L321: do not delete KAI's generated queue in cleanup.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tutorials/labs/kai-scheduler-hami.md` around lines 128 - 149, Do not mutate
or delete KAI-generated queues: in tutorials/labs/kai-scheduler-hami.md lines
128-149 and
i18n/zh/docusaurus-plugin-content-docs-tutorials/current/labs/kai-scheduler-hami.md
lines 129-150, remove the manual default-queue setup or replace it with uniquely
named lab queues; in both files’ cleanup lines 320 and 321, delete only
resources created by the lab, not KAI’s generated default-queue.

Source: MCP tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tutorials/labs/kai-scheduler-hami.md`:
- Around line 298-303: The reservation Pod lookup is arbitrary and may select no
Pod or the wrong workload. In tutorials/labs/kai-scheduler-hami.md:298-303, wait
for the reservation Pod and select the Pod associated with
gpu-sharing-with-isolation using its owner, label, or exact BindingError name
before running kubectl logs; apply the same correlated selection in
i18n/zh/docusaurus-plugin-content-docs-tutorials/current/labs/kai-scheduler-hami.md:299-304.
- Line 292: Correct the GPU fraction arithmetic in both tutorials: update
tutorials/labs/kai-scheduler-hami.md lines 292-292 and
i18n/zh/docusaurus-plugin-content-docs-tutorials/current/labs/kai-scheduler-hami.md
lines 293-293 so 20480 / 40960 is stated as 0.50; if retaining the reported 1.51
total, explain it through scheduler rounding or base-memory calculation rather
than the incorrect equation.
- Around line 97-100: Update the prerequisite lists in
tutorials/labs/kai-scheduler-hami.md at lines 49-52 and 97-100, and in
i18n/zh/docusaurus-plugin-content-docs-tutorials/current/labs/kai-scheduler-hami.md
at lines 50-53 and 98-101, to include NVCR/NGC access or document a mirrored
image for the NVIDIA device-plugin image used by the kubectl apply step. Keep
the English and Chinese prerequisite guidance consistent.
- Around line 121-153: Wait for KAI admission/webhook readiness after the Helm
install and before applying Queue resources in both
tutorials/labs/kai-scheduler-hami.md (lines 121-153) and
i18n/zh/docusaurus-plugin-content-docs-tutorials/current/labs/kai-scheduler-hami.md
(lines 122-154). Add a readiness wait or retry loop that handles certificate and
webhook startup delays, while preserving the existing Queue manifests and
subsequent kubectl checks.

---

Nitpick comments:
In `@tutorials/labs/kai-scheduler-hami.md`:
- Around line 49-60: Pin the kind Kubernetes node image in the cluster creation
command to a tested kindest/node version, replacing the implicit default. Apply
the same pin to the corresponding command in
tutorials/labs/kai-scheduler-hami.md (lines 49-60) and
i18n/zh/docusaurus-plugin-content-docs-tutorials/current/labs/kai-scheduler-hami.md
(lines 50-61); keep the existing NODE_NAME assignment unchanged.
- Around line 128-149: Do not mutate or delete KAI-generated queues: in
tutorials/labs/kai-scheduler-hami.md lines 128-149 and
i18n/zh/docusaurus-plugin-content-docs-tutorials/current/labs/kai-scheduler-hami.md
lines 129-150, remove the manual default-queue setup or replace it with uniquely
named lab queues; in both files’ cleanup lines 320 and 321, delete only
resources created by the lab, not KAI’s generated default-queue.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 2455f650-913e-4d91-afae-78f83f06b565

📥 Commits

Reviewing files that changed from the base of the PR and between c0e0f77 and badda80.

📒 Files selected for processing (3)
  • i18n/zh/docusaurus-plugin-content-docs-tutorials/current/labs/kai-scheduler-hami.md
  • sidebars-tutorials.js
  • tutorials/labs/kai-scheduler-hami.md

Comment thread tutorials/labs/kai-scheduler-hami.md
Comment thread tutorials/labs/kai-scheduler-hami.md
Comment thread tutorials/labs/kai-scheduler-hami.md Outdated
Comment thread tutorials/labs/kai-scheduler-hami.md
Signed-off-by: maishivamhoo123 <maishivamhoo@gmail.com>
Signed-off-by: maishivamhoo123 <maishivamhoo@gmail.com>
@rootsongjc

Copy link
Copy Markdown
Contributor

Reproduced end-to-end on kind (KAI v0.17.0, isolator 1.1.0-chart) all 8 steps match.

Two optional nits:

  1. Step 7 CUDA_DISABLE_CONTROL: shared Pod never leaves Pending on mock (Step 8), so it's unobservable here. Note it's a real-GPU safeguard, or drop it.
  2. Step 5 handler: runc: add "mock-only" , on real GPU it blocks device injection.

Signed-off-by: maishivamhoo123 <maishivamhoo@gmail.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
tutorials/labs/kai-scheduler-hami.md (1)

74-81: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Pin the external mock artifacts in both tutorials.

The verified output depends on a repository branch, an unversioned chart, and a mutable raw manifest. Pin every input used by the lab.

  • tutorials/labs/kai-scheduler-hami.md#L74-L81: pin the k8s-test-infra checkout and nvml-mock chart.
  • tutorials/labs/kai-scheduler-hami.md#L99-L101: reference the manifest at the verified commit.
  • i18n/zh/docusaurus-plugin-content-docs-tutorials/current/labs/kai-scheduler-hami.md#L74-L81: apply the same checkout and chart pins.
  • i18n/zh/docusaurus-plugin-content-docs-tutorials/current/labs/kai-scheduler-hami.md#L99-L101: reference the same verified manifest commit.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tutorials/labs/kai-scheduler-hami.md` around lines 74 - 81, Pin all external
mock artifacts used by the tutorials: in tutorials/labs/kai-scheduler-hami.md
lines 74-81 and
i18n/zh/docusaurus-plugin-content-docs-tutorials/current/labs/kai-scheduler-hami.md
lines 74-81, check out the verified k8s-test-infra commit and use the
corresponding pinned nvml-mock chart version; in both files’ lines 99-101,
replace the mutable manifest reference with the manifest at that same verified
commit.

Source: MCP tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tutorials/labs/kai-scheduler-hami.md`:
- Around line 133-154: Adopt one KAI queue ownership model across all affected
sites: in tutorials/labs/kai-scheduler-hami.md lines 133-154, remove the
manually defined default Queue (or disable chart creation via
defaultQueue.createDefaultQueue=false), then update lines 160-176 to show the
resulting queue hierarchy. Apply the same manifest and output changes in the
Chinese translation at lines 133-154 and 160-176, keeping the English and
Chinese descriptions consistent with the retained model.
- Line 180: Update the English explanation at
tutorials/labs/kai-scheduler-hami.md:180 and the Chinese explanation at
i18n/zh/docusaurus-plugin-content-docs-tutorials/current/labs/kai-scheduler-hami.md:180
to separate the KAI Scheduler admission configuration’s
admission.gpuPodRuntimeClassName responsibility from the isolator webhook.
Attribute HAMi-core mounts and /etc/ld.so.preload injection to the isolator, and
explain that runtimeClassName: nvidia is required only for shared/GPU resource
Pods via the shim RuntimeClass, not injected by the HAMi-core webhook.

---

Nitpick comments:
In `@tutorials/labs/kai-scheduler-hami.md`:
- Around line 74-81: Pin all external mock artifacts used by the tutorials: in
tutorials/labs/kai-scheduler-hami.md lines 74-81 and
i18n/zh/docusaurus-plugin-content-docs-tutorials/current/labs/kai-scheduler-hami.md
lines 74-81, check out the verified k8s-test-infra commit and use the
corresponding pinned nvml-mock chart version; in both files’ lines 99-101,
replace the mutable manifest reference with the manifest at that same verified
commit.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: fb92386b-6102-48db-a75f-0ea68c42f16e

📥 Commits

Reviewing files that changed from the base of the PR and between badda80 and c9a5f2b.

📒 Files selected for processing (2)
  • i18n/zh/docusaurus-plugin-content-docs-tutorials/current/labs/kai-scheduler-hami.md
  • tutorials/labs/kai-scheduler-hami.md

Comment thread tutorials/labs/kai-scheduler-hami.md
Comment thread tutorials/labs/kai-scheduler-hami.md
@maishivamhoo123

Copy link
Copy Markdown
Member Author

Reproduced end-to-end on kind (KAI v0.17.0, isolator 1.1.0-chart) all 8 steps match.

Two optional nits:

  1. Step 7 CUDA_DISABLE_CONTROL: shared Pod never leaves Pending on mock (Step 8), so it's unobservable here. Note it's a real-GPU safeguard, or drop it.
  2. Step 5 handler: runc: add "mock-only" , on real GPU it blocks device injection.

@rootsongjc i made all the suggested changes can you please look into this once.
Thank you!

@rootsongjc

Copy link
Copy Markdown
Contributor

@maishivamhoo123 This experiment is valid as a control plane and failure boundary experiment in an nvml-mock environment. However, the current title and the conclusions of steps 6 and 7 describe resource scheduling, queue accounting, and PodSpec injection as a complete GPU path and HAMi-core runtime verification. It is recommended to retain the expected failure design in step 8, while narrowing the experimental objective, modifying the verification statement, and adding checks for CUDA_DEVICE_MEMORY_LIMIT and the final Pod state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants