Skip to content

Instantly share code, notes, and snippets.

@klueska
klueska / Dockerfile.runsc-gpu-test
Created October 27, 2026 17:49
Manual test for runsc --nvproxy-dev-roots with CDI and a driver container
# syntax=docker/dockerfile:1
#
# Manual test for gVisor's --nvproxy-dev-roots: GPU workloads under runsc, run
# through containerd and CRI with the GPUs injected by CDI, on a host whose
# NVIDIA driver runs in a driver container (device nodes under
# /run/nvidia/driver/dev, none in the host's /dev).
#
# runsc and its containerd shim are built here from the gVisor checkout used as
# the build context. A second runsc, built from upstream master, is registered
# as the runsc-baseline runtime and is expected to fail on such a host.
@klueska
klueska / Dockerfile.sandbox-gpu-test
Last active September 27, 2026 21:48
Dockerfile.sandbox-gpu-test
# Test image for the sandbox-gpu-cdi-support branch's real-hardware GPU tests.
#
# The build stage and the final stage follow the Dockerfiles in the Ray Sandboxes
# docs (doc/source/ray-core/sandboxes.md), with one difference: rather than having
# a separate Dockerfile per kernel page size, it detects the page size of the
# machine running the build with `getconf PAGESIZE`, unless PAGE_SIZE is passed as
# a build argument. At 4 KiB it downloads gVisor's prebuilt runsc, as the docs'
# 4 KiB Dockerfile does. At any other size it builds runsc from source, as the
# docs' 64 KiB Dockerfile does. Build this image on the machine it runs on, since
# the page size is a property of the kernel the build shares with that machine.
package api
import (
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
const (
DevMgmtAPIVersion = "devmgmtproto.k8s.io/v1alpha1"
)
@klueska
klueska / nodeResourceSlice.go
Created February 12, 2024 10:24
NodeResourceSliceSpec
package main
import (
semverv4 "github.com/blang/semver/v4"
"k8s.io/apimachinery/pkg/api/resource"
)
type NodeResourceSliceSpec struct {
// NodeName identifies the node where the capacity is available.
// A field selector can be used to list only NodeResources
diff --git a/pkg/kubelet/cm/devicemanager/plugin/v1beta1/handler.go b/pkg/kubelet/cm/devicemanager/plugin/v1beta1/handler.go
index cea6317257e..bdec8984139 100644
--- a/pkg/kubelet/cm/devicemanager/plugin/v1beta1/handler.go
+++ b/pkg/kubelet/cm/devicemanager/plugin/v1beta1/handler.go
@@ -44,10 +44,9 @@ func (s *server) RegisterPlugin(pluginName string, endpoint string, versions []s
func (s *server) DeRegisterPlugin(pluginName string) {
klog.V(2).InfoS("Deregistering plugin", "plugin", pluginName)
- s.mutex.Lock()
- defer s.mutex.Unlock()
# Run the export command of nvidia-mig-parted
nvidia-mig-parted export
# Show nvidia-smi on the host with 8 full GPUs
nvidia-smi -L
# List out the NVIDIA container toolkit packages installed
dpkg -l | grep nvidia-container; dpkg -l | grep nvidia-docker
# Show that docker is configured to run with the nvidia container toolkit
layout blog
title Kubernetes Topology Manager Moves to Beta - Align Up!
date 2020-03-30
slug kubernetes-1-18-feature-topoloy-manager-beta

Authors: Kevin Klues (NVIDIA), Victor Pickard (RedHat), Conor Nolan (Intel)

This blog post describes the TopologyManager, a beta feature of Kubernetes in release 1.18. The TopologyManager feature enables NUMA alignment of CPUs and peripheral devices (such as SR-IOV VFs and GPUs), allowing your workload to run in an environment optimized for low-latency.

--- blog-orig.md 2020-03-31 13:06:09.899071690 +0200
+++ blog.md 2020-03-31 13:04:49.594078489 +0200
@@ -7,46 +7,52 @@
**Authors:** Kevin Klues (NVIDIA), Victor Pickard (RedHat), Conor Nolan (Intel)
-This blog post describes the **<code>TopologyManager</code>**, a beta feature of Kubernetes in release 1.18. The <strong><code>TopologyManager</code></strong> feature enables NUMA alignment of CPUs and peripheral devices (such as SR-IOV VFs and GPUs), allowing your workload to run in an environment optimized for low-latency.
+This blog post describes the **<code>TopologyManager</code>**, a beta feature of Kubernetes in release 1.18. The **<code>TopologyManager</code>** feature enables NUMA alignment of CPUs and peripheral devices (such as SR-IOV VFs and GPUs), allowing your workload to run in an environment optimized for low-latency.
-Prior to the introduction of the **<code>TopologyManager</code>**, the CPU and Device Manager would make resource allocation decisions independent of each other. This could resu
#!/usr/bin/env bash
# Declare some helper functions
function get_kubernetes_hostname() {
local json="$(kubectl get nodes -o json)"
echo ${json} | python -c "$(cat << EOF
import sys
import json
nodes = json.load(sys.stdin)
import itertools
import prettytable
from prettytable import PrettyTable
affinities = [
(0,1),
(1,0),
(1,1),
]