Skip to content

docs(kubernetes): add GPU sharing with HAMi guide#517

Merged
Aleksei Sviridkin (lexfrei) merged 3 commits into
mainfrom
docs/hami-gpu-sharing
Apr 29, 2026
Merged

docs(kubernetes): add GPU sharing with HAMi guide#517
Aleksei Sviridkin (lexfrei) merged 3 commits into
mainfrom
docs/hami-gpu-sharing

Conversation

@Arsolitt

@Arsolitt Arsolitt (Arsolitt) commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Summary by CodeRabbit

  • Documentation
    • Added documentation for GPU sharing with HAMi, covering integration details, configuration instructions, resource request examples, customization options, and known limitations.

Document the HAMi GPU virtualization addon for tenant Kubernetes
clusters, covering architecture, setup, fractional resource requests,
custom configuration, and known glibc limitations.

Signed-off-by: Arsolitt <arsolitt@gmail.com>
@netlify

netlify Bot commented Apr 28, 2026

Copy link
Copy Markdown

Deploy Preview for cozystack ready!

Name Link
🔨 Latest commit 985f68a
🔍 Latest deploy log https://app.netlify.com/projects/cozystack/deploys/69f0e4771242790008f0dcee
😎 Deploy Preview https://deploy-preview-517--cozystack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@coderabbitai

coderabbitai Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@Arsolitt has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 42 minutes and 23 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 09666e59-5c6f-4925-b8d4-d6ad58405ee2

📥 Commits

Reviewing files that changed from the base of the PR and between d64a890 and 985f68a.

📒 Files selected for processing (1)
  • content/en/docs/next/kubernetes/gpu-sharing.md
📝 Walkthrough

Walkthrough

Introduces a new documentation page explaining GPU sharing with HAMi (Heterogeneous Application Module interface) in tenant Kubernetes clusters. The page covers HAMi's integration components, configuration setup, fractional GPU resource requests, customization options, and known limitations.

Changes

Cohort / File(s) Summary
GPU Sharing Documentation
content/en/docs/next/kubernetes/gpu-sharing.md
New documentation page detailing HAMi GPU sharing functionality, including scheduler extender/device plugin integration, mutating webhook routing, libvgpu.so injection, workload GPU request examples, valuesOverride customization knobs (device split count, memory scaling, scheduling policies), and known limitations (glibc compatibility across Ubuntu versions, musl incompatibility).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐰 A GPU shared is joy multiplied,
HAMi's wisdom, now by your side!
Fractional cores in harmony dance,
Documentation lights the path advance.
Share those resources, let workloads soar! ✨

🚥 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 accurately and concisely describes the main change: adding documentation for GPU sharing with HAMi in Kubernetes, which matches the single new markdown file and the PR's primary objective.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/hami-gpu-sharing

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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
content/en/docs/next/kubernetes/gpu-sharing.md (1)

141-144: ⚠️ Potential issue | 🔴 Critical

Fix unmatched trailing Markdown code fence (docs build risk).

There’s a stray closing ``` at the end of the file (after the musl/libc paragraph). This will break Markdown/Hugo rendering and can fail the doc build.

✅ Proposed fix
### Alpine / musl libc

 HAMi-core is incompatible with musl libc. Only glibc-based container images (Debian, Ubuntu, RHEL) are supported.
-```
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@content/en/docs/next/kubernetes/gpu-sharing.md` around lines 141 - 144,
Remove the stray closing Markdown code fence found immediately after the "###
Alpine / musl libc" paragraph; locate the unmatched ``` at the end of the file
and delete it (or, if an intended block was opened earlier, ensure the fence
pair is properly balanced by adding a matching opening fence instead). This
fixes the dangling code fence that breaks Markdown/Hugo rendering.
🧹 Nitpick comments (2)
content/en/docs/next/kubernetes/gpu-sharing.md (2)

61-79: Align the Pod example with the “prefer gpumem-percentage” guidance (minor clarity).

The text recommends preferring nvidia.com/gpumem-percentage, but the Pod manifest example uses nvidia.com/gpumem. Consider updating the example to use gpumem-percentage (or add a brief note: “Example uses gpumem for concreteness; use gpumem-percentage for portability”).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@content/en/docs/next/kubernetes/gpu-sharing.md` around lines 61 - 79, The Pod
manifest example uses the resource key nvidia.com/gpumem while the text advises
preferring nvidia.com/gpumem-percentage; update the example to use
nvidia.com/gpumem-percentage instead of nvidia.com/gpumem (or alternatively add
a one-line clarifying note after the YAML saying “This example uses gpumem for
concreteness; prefer gpumem-percentage for portability”). Locate the manifest
block with the container named cuda-app and change the resource key or add the
note accordingly to keep example and guidance consistent.

122-140: Add a “how to confirm HAMi-core loaded” step for silent failure modes.

You describe several “fails silently / no isolation” cases (Ubuntu 22.04 and 24.04), but the guide doesn’t give a concrete verification/debug step. Since workloads can run without GPU limits when HAMi-core can’t load, it’d be safer UX to add a short section near this table like: “How to verify HAMi-core is active” (e.g., check component logs on startup, confirm LD_PRELOAD injection, or validate that GPU limits actually constrain memory/compute in a quick test). This directly mitigates the operational risk you’re warning about.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@content/en/docs/next/kubernetes/gpu-sharing.md` around lines 122 - 140, Add a
short "How to verify HAMi-core is active" section immediately after the glibc
compatibility table that gives concrete, actionable checks: instruct readers to
inspect HAMi-core startup logs for successful load messages (referencing
"HAMi-core"), verify LD_PRELOAD is injected into the workload container
environment (check process env for LD_PRELOAD), and run a quick validation that
GPU limits apply (e.g., launch a test workload that would exceed expected
memory/compute limits and confirm it is constrained). Mention these three checks
explicitly so operators can detect the silent-failure modes on Ubuntu
22.04/24.04 images.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@content/en/docs/next/kubernetes/gpu-sharing.md`:
- Around line 141-144: Remove the stray closing Markdown code fence found
immediately after the "### Alpine / musl libc" paragraph; locate the unmatched
``` at the end of the file and delete it (or, if an intended block was opened
earlier, ensure the fence pair is properly balanced by adding a matching opening
fence instead). This fixes the dangling code fence that breaks Markdown/Hugo
rendering.

---

Nitpick comments:
In `@content/en/docs/next/kubernetes/gpu-sharing.md`:
- Around line 61-79: The Pod manifest example uses the resource key
nvidia.com/gpumem while the text advises preferring
nvidia.com/gpumem-percentage; update the example to use
nvidia.com/gpumem-percentage instead of nvidia.com/gpumem (or alternatively add
a one-line clarifying note after the YAML saying “This example uses gpumem for
concreteness; prefer gpumem-percentage for portability”). Locate the manifest
block with the container named cuda-app and change the resource key or add the
note accordingly to keep example and guidance consistent.
- Around line 122-140: Add a short "How to verify HAMi-core is active" section
immediately after the glibc compatibility table that gives concrete, actionable
checks: instruct readers to inspect HAMi-core startup logs for successful load
messages (referencing "HAMi-core"), verify LD_PRELOAD is injected into the
workload container environment (check process env for LD_PRELOAD), and run a
quick validation that GPU limits apply (e.g., launch a test workload that would
exceed expected memory/compute limits and confirm it is constrained). Mention
these three checks explicitly so operators can detect the silent-failure modes
on Ubuntu 22.04/24.04 images.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 367c9002-4bbe-4528-b07e-5f245a8a8b18

📥 Commits

Reviewing files that changed from the base of the PR and between bc2745e and d64a890.

📒 Files selected for processing (1)
  • content/en/docs/next/kubernetes/gpu-sharing.md

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new documentation page for GPU sharing using HAMi in tenant Kubernetes clusters, detailing its architecture, configuration, and known limitations. Feedback includes a suggestion to use relative links for better documentation portability and a correction regarding the nvidia.com/gpu resource description to accurately reflect that multiple virtual GPUs can be requested.

[HAMi](https://github.com/Project-HAMi/HAMi) (Heterogeneous AI Computing Virtualization Middleware) is a CNCF Sandbox project that enables fractional GPU sharing in Kubernetes. Instead of dedicating an entire GPU to a single workload, HAMi lets containers request specific amounts of GPU memory and compute cores.

{{% alert color="info" %}}
This guide covers GPU sharing for **containers in tenant Kubernetes clusters**. For GPU passthrough to virtual machines on the management cluster, see [GPU Passthrough](/docs/next/virtualization/gpu/).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Using an absolute path like /docs/next/ makes the link fragile if the documentation version changes or if the site is viewed in a different context (e.g., a preview environment). It is generally better to use a relative link to maintain portability across different versions of the documentation.

Suggested change
This guide covers GPU sharing for **containers in tenant Kubernetes clusters**. For GPU passthrough to virtual machines on the management cluster, see [GPU Passthrough](/docs/next/virtualization/gpu/).
This guide covers GPU sharing for **containers in tenant Kubernetes clusters**. For GPU passthrough to virtual machines on the management cluster, see [GPU Passthrough](../virtualization/gpu/).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Absolute /docs/next/ paths are the documented convention for this repo (see CLAUDE.md line 70). They are intentionally rewritten to versioned paths by hack/release_next.sh during the release process. Using relative paths would bypass this rewrite mechanism and produce broken links after version promotion.


| Resource | Description |
| --- | --- |
| `nvidia.com/gpu` | Number of virtual GPUs (always `1` per container) |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The description for nvidia.com/gpu states it is "always 1 per container". While this is the standard for fractional sharing, HAMi does support requesting multiple virtual GPUs (e.g., nvidia.com/gpu: 2) if the pod needs to span multiple physical GPUs or multiple partitions. Unless this is a specific restriction of the Cozystack integration, it would be more accurate to describe it as the number of virtual GPUs requested by the container.

Suggested change
| `nvidia.com/gpu` | Number of virtual GPUs (always `1` per container) |
| `nvidia.com/gpu` | Number of virtual GPUs requested |

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch — HAMi does support requesting multiple virtual GPUs per container. Updated the description to "Number of virtual GPUs requested" in 985f68a.

Add a note after the Pod YAML example explaining when to prefer
gpumem-percentage over absolute gpumem values.

Signed-off-by: Arsolitt <arsolitt@gmail.com>
HAMi supports requesting multiple virtual GPUs per container, so the
"always 1" constraint was inaccurate.

Signed-off-by: Arsolitt <arsolitt@gmail.com>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cross-checked the technical claims against the feature PR (cozystack/cozystack#2484) and upstream sources:

  • glibc compatibility table is consistent with the system-package README and matches HAMi#1190 maintainer thread (Ubuntu 22.04 / 2.35: memory works, compute fails; Ubuntu 24.04 / 2.39: both fail).
  • The deliberate choice of nvcr.io/nvidia/cuda:11.8.0-base-ubuntu20.04 in the example pod is a thoughtful detail — the demo gets full isolation because Ubuntu 20.04 ships glibc 2.31 (< 2.34).
  • The warning alert about silent failure ("workloads still run but without any GPU resource limits") is exactly what an operator needs to know.
  • nvidia.com/GA102GL_A10 matches the example in packages/apps/vm-instance/values.yaml, the GPU Passthrough cross-link resolves to content/en/docs/next/virtualization/gpu.md, the instanceType: u1.xlarge is a kubevirt-instancetype name (orthogonal to the cozy-lib resourcesPreset rename in cozystack/cozystack#1959, which uses the same naming pattern but is a different concept — no collision).
  • Citation chain is cleaner here than in the system README (no HAMi#173, which is the weak link there).

LGTM.

Aleksei Sviridkin (lexfrei) added a commit to cozystack/cozystack that referenced this pull request Apr 29, 2026
## What this PR does

Documentation: cozystack/website#517

Integrates [HAMi](https://github.com/Project-HAMi/HAMi) v2.8.1 (CNCF
Sandbox) into Cozystack as a system-level package for fractional GPU
sharing in tenant Kubernetes clusters.

The integration covers three layers:

- **System chart** (`packages/system/hami/`): Vendors upstream HAMi Helm
chart with device plugin, scheduler extender, mutating webhook, and
RuntimeClass configuration. The broken DRA subchart was removed — it
renders resources even when disabled and references unpublished images.

- **Kubernetes app addon** (`packages/apps/kubernetes/`): HAMi exposed
as an optional toggle (`hami.enabled`). Automatically disables GPU
Operator's native device plugin when active to avoid conflicts. Enforces
hard dependency on GPU Operator.

- **Platform registration** (`packages/core/platform/`): HAMi declared
as PackageSource with gpu-operator dependency, included in the iaas
bundle.

**Known limitation**: HAMi-core relies on a private glibc symbol
(`_dl_sym`) removed in glibc 2.34, which breaks compute isolation on
modern container images (Ubuntu 22.04+, PyTorch/TensorFlow official
images). Alpine/musl is entirely incompatible. See the package README
for details and upstream issue references.

### Screenshots

N/A — no UI changes.

### Release note

```release-note
feat(hami): add HAMi GPU virtualization as an optional system package for fractional GPU sharing. Enables memory and compute isolation for NVIDIA GPUs across tenant workloads. Integrates with GPU Operator and can be enabled per-cluster via the hami.enabled toggle. Note: compute isolation requires glibc < 2.34 in workload containers.
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added HAMi GPU virtualization middleware as an optional cluster addon
to enable fractional GPU sharing.
* HAMi addon includes an enable toggle (default: disabled) and a
customizable Helm values override; when enabled it enforces GPU Operator
presence and adjusts GPU Operator values accordingly.
* New HelmRelease integration for deploying HAMi with dependency
ordering and conditional rendering.

* **Documentation**
* Added HAMi setup guide, compatibility notes, and updated cluster addon
configuration reference.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@lexfrei Aleksei Sviridkin (lexfrei) merged commit ed204fa into main Apr 29, 2026
6 checks passed
@lexfrei Aleksei Sviridkin (lexfrei) deleted the docs/hami-gpu-sharing branch April 29, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants