#14252·containerd

[SIG-Node]: 4216 - Support image pull per runtime class

Author: ChengyuZhu6Created Sep 29, 2026Updated Sep 29, 2026
Labelskind/featurearea/cri

KEP/SIG-Node References

What is the SIG-Node problem you are trying to solve

KEP-4216 extends CRI with an optional ImageSpec.runtime_handler so that a runtime identifies an image as a tuple of (imageName/imageDigest, runtimeClass) instead of (imageName/imageDigest). Multiple "variants" of the same image reference can then coexist on one node, selected per runtime handler.

The Kubernetes side is done. CRI has the field, and kubelet has the plumbing behind RuntimeClassInImageCriApi:

  • EnsureImageExists() takes podRuntimeHandler and buildskubecontainer.ImageSpec{Image, Annotations, RuntimeHandler} (pkg/kubelet/images/image_manager.go).
  • Image GC indexes imageRecords by a "<imageID>,<runtimeHandler>" tuple and calls RemoveImage(ctx, container.ImageSpec{Image: id, RuntimeHandler: ...}) (pkg/kubelet/images/image_gc_manager.go, getImageTuple() / freeImage()).
  • ListImages() consumes img.Spec.RuntimeHandler; if a runtime does not populate it, kubelet logs WARNING: RuntimeHandler is empty and falls back to image-ID-only indexing (pkg/kubelet/kuberuntime/kuberuntime_image.go).

Two concrete user-visible drivers:

  1. Windows: the platform matcher requires an exact host/guest OS version match, which is wrong for Hyper-V isolated containers whose UVM OS version differs from the host. The pull should match the guest platform configured for the runtime handler instead.
  2. Snapshotter per runtime class / remote snapshotters: the same image reference pulled under two runtime classes needs to be unpacked once per snapshotter (for example overlayfs and a lazy-pulling remote snapshotter). containerd keeps one entry per image, so the second runtime class is told the image is already present and never gets its own unpack, and RemoveImage drops it for every runtime class.

Describe the solution you would like

  • Update cri-api — done, vendored v0.37.1 already has ImageSpec.runtime_handler
  • Honor runtime_handler in PullImage (snapshotter selection works today, platform does not)
  • Identify images as a tuple of (imageName, runtimeClass) in the CRI image store
  • Unpack an image per runtime class / snapshotter
  • Report the runtime class in ListImages / ImageStatus, and scope RemoveImage to it
  • Add a runtime class label to containerd images
  • Reject unknown runtime handlers
  • Update GC so an image is removed only when no runtime class still references it
  • Add functional and e2e tests
  • Extend ctr (crictl changes belong to kubernetes-sigs/cri-tools)

Additional context

No response