Description
Description
Windows HostProcess containers do not inherit the same Windows OS version compactivity requirements as regular Windows Server containers. This means that a HostProcess container built can run on any Windows Server version.
The existing logic in the image platform matching code only returns a match when os=windows
if the osversion
matches what the currently running Windows Server version. This limits the useful ness of HostProcess containers by making them difficult to use in multi-arch manifest-lists.
Some use cases where this would be good to have working include Kubernetes infrastructure images like the kube-proxy, CNI images, etc. Since these workloads will need to run as HostProcess containers it would be desirable to include a single entry in the manifest-list for the Windows images (with arch=amd64
and os=windows
specified but not having `osversion= set).
Using a single image for multiple Windows OS versions works today if the image is a single manifest and all platform attributes are omitted
Ex:
docker manifest inspect mrosse3/mcr-hpc-test:v0.1.0
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"schemaVersion": 2,
"config": {
"mediaType": "application/vnd.docker.container.image.v1+json",
"digest": "sha256:b01815998e5ac6bd7aed386a3c5dd94e9531b323a536dcf645f226a108966742",
"size": 1345
},
"layers": [
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar",
"digest": "sha256:7dca6d47adc755dcbc146a8d26b251b7d08d5b8ce8336b04e1ad824cd3be763b",
"size": 20480
},
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"digest": "sha256:0285fde2e7b1c2e110ff0e88966af55f1ef66f9e433591f5f613aba6aad831fb",
"size": 466
}
]
}
Steps to reproduce the issue
- Create a manifest-list containing one a Linux image and a Windows image (intended to be run as a HostProcess container)
docker manifest inspect mrosse3/hpc-manifest-list-test:latest
{
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
"manifests": [
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 728,
"digest": "sha256:081f486645e4e0bb51ae7fe455da6d6baa4c059b2a88ff7f4302de1b22d40d3c",
"platform": {
"architecture": "amd64",
"os": "windows"
}
},
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 526,
"digest": "sha256:e2e85ebf25993e1528262fdcce76106aa4c2a9721fab5e944e1b93c0e3204a02",
"platform": {
"architecture": "amd64",
"os": "linux"
}
}
]
}
- Schedule a Pod which runs this container to a Windows node
The result is the image fails to pull with the follow error
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 12s default-scheduler Successfully assigned default/ping to capz-conf-fg8px
Normal Pulling 11s kubelet Pulling image "mrosse3/hpc-manifest-list-test:latest"
Warning Failed 9s kubelet Failed to pull image "mrosse3/hpc-manifest-list-test:latest": rpc error: code = NotFound desc = failed to pull and unpack image "docker.io/mrosse3/hpc-manifest-list-test:latest": no match for platform in manifest: not found
Normal BackOff 9s kubelet Back-off pulling image "mrosse3/hpc-manifest-list-test:latest"
Describe the results you received and expected
I would expect this image to be able to be pulled onto the Windows node and the container to start.
I think there are a few different options for supporting this scenario.
- Update the platform matching logic for windows to be aware of some 'magic value' that indicates the image is a HostProcess container and we can skip matching on OSVersion
- Update the platform matching logic to allow for running images with only arch/os set on Windows (but still prefer to match n arch/os/version if there is a compatible image.
Note: If we decide to use a magic value we can update the Descriptor on the HostProcess container base image to set this value to ease container building them.
docker manifest inspect mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image:v1.0.0 -v
[
{
"Ref": "mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image:v1.0.0@sha256:4c5b2a2c0440d2fb50715774c5d1cb2a26997ce1d1d86586cbea882953bfad70",
"Descriptor": {
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"digest": "sha256:4c5b2a2c0440d2fb50715774c5d1cb2a26997ce1d1d86586cbea882953bfad70",
"size": 420,
"platform": {
"architecture": "amd64",
"os": "windows"
}
},
"SchemaV2Manifest": {
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"config": {
"mediaType": "application/vnd.docker.container.image.v1+json",
"digest": "sha256:66db2536358359ac97453425532c82b15e9873f1630fbc94c6be80f75620f501",
"size": 870
},
"layers": [
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar",
"digest": "sha256:f2784c8bc8525977aef9b6cd74e9a899274db7d82cd4b028e0ae049270927585",
"size": 20480
}
]
}
}
]
What version of containerd are you using?
v1.6.8 or latest built from main
Any other relevant information
No response
Show configuration if it is related to CRI plugin.
No response