Seekable OCI and the Kubernetes Runtime Class #984
Replies: 3 comments
-
Something I missed when I initially suggested using SOCI in a dedicated runtime class is that k8s only very recently added alpha support for runtime-class-aware images (kubernetes/enhancements#4216) and it's not yet supported in containerd (containerd/containerd#9377). The problem is that while you can specify a snapshotter to use in a runtime class, kubelet/CRI don't know about it without this new feature. To them an image is independent of runtime classes. So, if you create a pod with a SOCI runtime class, all the images will be pulled with the SOCI snapshotter. Later, if you try to create a pod with the default runtime class (which uses OverlayFS), then kubelet/CRI will see that the pause image (for example) already exists so they will skip the image pull. When kubelet tries to launch it, however, the image won't be found because containerd is expecting it in the OverlayFS snapshotter, but it's actually in the SOCI snapshotter. This makes runtime classes with SOCI pretty much identical to just setting SOCI as the default snapshotter for all pods because you can only successfully use one runtime class snapshotter per node. Thankfully the problem is already known upstream and there is work being done to resolve the issue. |
Beta Was this translation helpful? Give feedback.
-
we would need containerd/containerd#5105 as well i think! |
Beta Was this translation helpful? Give feedback.
-
I experimented a bit in awslabs/amazon-eks-ami@master...dims:amazon-eks-ami:support-for-soci-snapshotter for starters |
Beta Was this translation helpful? Give feedback.
-
You can use a Kubernetes Runtime Class to choose which pods are sent to the SOCI snapshotter and which stay with the default (overlayfs) snapshotter, as mentioned by @Kern-- . The feature is available in containerd 1.7, and yesterday the EKS AMI started shipping with containerd 1.7 🎉, so I wanted to quickly write up my experience of getting started with Kubernetes Runtime Class and SOCI on EKS.
Environment
1.28.3-20231201
soci-snapshotter-grpc
v0.4.0 binary on the node and managed / started by systemd/etc/containerd/config.toml
)overlayfs
(this is the default for all pods)soci
runtime class in containerd which uses thesoci
snapshottermy containerd config
/etc/soci-snapshotter-grpc/config.toml
)containerd
content store under thek8s.io
namespace for my SOCI artifacts (not mandatory).my soci-snapshotter config
/root/.docker/config.json
)my credentials config
Failed Experiment
runtimeClassName
set tosoci-runtime
Pod Spec
The pod fails with a
CreateContainerError
Looking in the containerd logs
So it appears containerd is unable to extract the base layer of my image (this was odd as containerd should not be doing image management). Checking the soci-snapshotter logs they are empty... This container image is not passed to the soci snapshotter :(
Successful Experiment
runtimeClassName
set tosoci-runtime
runtime-handler
annotation set to the runtime in my containerd configsoci
Pod Spec
The pod is now running!!!
Checking the soci snapshotter logs, there are log messages! containerd has delegated image management for this pod to the soci-snapshotter :)
Beta Was this translation helpful? Give feedback.
All reactions