-
Notifications
You must be signed in to change notification settings - Fork 28
examples: add gpu-operator kind cluster walkthrough #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
shivakunv
wants to merge
1
commit into
main
Choose a base branch
from
kind_demo
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+644
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,160 @@ | ||
| # GPU Operator Kind Demo | ||
|
|
||
| This example uses [gpu-operator-kind-demo.sh](./gpu-operator-kind-demo.sh) to create an `nvkind` cluster, install NVIDIA GPU Operator with `driver.enabled=false`, and verify GPU access with a sample workload. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| The demo host must have: | ||
|
|
||
| - Linux on Ubuntu or Debian | ||
| - An NVIDIA GPU visible on the host | ||
| - A working host NVIDIA driver | ||
|
|
||
| Verify the host driver before running the demo: | ||
|
|
||
| ```bash | ||
| nvidia-smi -L | ||
| ``` | ||
|
|
||
| If `nvidia-smi` is missing, install the host driver first: | ||
|
|
||
| ```bash | ||
| sudo apt-get update | ||
| sudo apt-get install -y ubuntu-drivers-common | ||
| sudo ubuntu-drivers devices | ||
| sudo ubuntu-drivers autoinstall | ||
| sudo reboot | ||
| ``` | ||
|
|
||
| The script will install or configure these tools if they are missing: | ||
|
|
||
| - Go `1.24.3` by default, or `NVKIND_GO_VERSION` | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why |
||
| - `nvkind` via `go install github.com/NVIDIA/nvkind/cmd/nvkind@latest` | ||
| - Docker | ||
| - `kind` | ||
| - `kubectl` | ||
| - `helm` | ||
| - `nvidia-container-toolkit` | ||
|
|
||
| ## Run The Demo | ||
|
|
||
| From `examples/gpu-operator/`: | ||
|
|
||
| ```bash | ||
| ./gpu-operator-kind-demo.sh all | ||
| ``` | ||
|
|
||
| This will: | ||
|
|
||
| - check host prerequisites | ||
| - install `nvkind` if it is missing | ||
| - configure Docker for NVIDIA GPUs | ||
| - create the `nvkind-gpu-operator-demo` cluster | ||
| - install GPU Operator | ||
| - run the sample `gpu-pod` workload | ||
|
|
||
| ## Script Modes | ||
|
|
||
| ```bash | ||
| ./gpu-operator-kind-demo.sh prepare | ||
| ./gpu-operator-kind-demo.sh cluster | ||
| ./gpu-operator-kind-demo.sh install | ||
| ./gpu-operator-kind-demo.sh verify | ||
| ./gpu-operator-kind-demo.sh status | ||
| ./gpu-operator-kind-demo.sh cleanup | ||
| ``` | ||
|
|
||
| What each mode does: | ||
|
|
||
| - `prepare`: checks or installs host-side prerequisites and validates Docker GPU access | ||
| - `cluster`: prepares the host and creates the demo cluster | ||
| - `install`: installs GPU Operator into the current demo cluster | ||
| - `verify`: prints cluster state and runs the sample GPU workload | ||
| - `status`: checks whether the existing demo cluster is healthy end-to-end | ||
| - `cleanup`: deletes the demo cluster | ||
|
|
||
| ## Status Check | ||
|
|
||
| To verify that an existing demo cluster is still healthy: | ||
|
|
||
| ```bash | ||
| ./gpu-operator-kind-demo.sh status | ||
| ``` | ||
|
|
||
| This checks: | ||
|
|
||
| - cluster existence | ||
| - node readiness | ||
| - NVIDIA runtime classes | ||
| - GPU Operator pod and daemonset health | ||
| - `ClusterPolicy` readiness | ||
| - end-to-end `gpu-pod` workload execution | ||
|
|
||
| ## What Success Looks Like | ||
|
|
||
| A successful run ends after the `gpu-pod` workload completes, with output like: | ||
|
|
||
| ```text | ||
| [demo] Demo completed successfully. | ||
| ``` | ||
|
|
||
| A successful status check ends with: | ||
|
|
||
| ```text | ||
| [demo] Status: kind demo is healthy. | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| If the script adds your user to the `docker` group and exits, refresh the shell group membership and rerun: | ||
|
|
||
| ```bash | ||
| newgrp docker | ||
| ./gpu-operator-kind-demo.sh all | ||
| ``` | ||
|
|
||
| If host driver validation fails, check: | ||
|
|
||
| ```bash | ||
| nvidia-smi -L | ||
| docker run --rm --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=all ubuntu:22.04 nvidia-smi -L | ||
| ``` | ||
|
|
||
| If `nvidia-smi` is not found, install the host driver first: | ||
|
|
||
| ```bash | ||
| sudo apt-get update | ||
| sudo apt-get install -y ubuntu-drivers-common | ||
| sudo ubuntu-drivers devices | ||
| sudo ubuntu-drivers autoinstall | ||
| sudo reboot | ||
| ``` | ||
|
|
||
| If cluster creation fails while joining the worker and kubelet logs show `inotify_init: too many open files`, raise the host file and inotify limits before retrying: | ||
|
|
||
| ```bash | ||
| sudo sysctl -w fs.inotify.max_user_instances=1024 | ||
| sudo sysctl -w fs.inotify.max_user_watches=524288 | ||
| sudo sysctl -w fs.file-max=2097152 | ||
| ulimit -n 1048576 | ||
| ``` | ||
|
|
||
| For better persistence across reruns, also raise Docker's file descriptor limit and restart Docker: | ||
|
|
||
| ```bash | ||
| sudo mkdir -p /etc/systemd/system/docker.service.d | ||
| sudo tee /etc/systemd/system/docker.service.d/limits.conf <<'EOF2' | ||
| [Service] | ||
| LimitNOFILE=1048576 | ||
| EOF2 | ||
| sudo systemctl daemon-reload | ||
| sudo systemctl restart docker | ||
| ``` | ||
|
|
||
| If the worker still fails to join, inspect the kind worker directly: | ||
|
|
||
| ```bash | ||
| docker exec nvkind-gpu-operator-demo-worker systemctl status kubelet --no-pager -l | ||
| docker exec nvkind-gpu-operator-demo-worker journalctl -u kubelet --no-pager -n 200 | ||
| docker exec nvkind-gpu-operator-demo-worker journalctl -u containerd --no-pager -n 200 | ||
| ``` | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: let's use multi-line here.