[SIG-Node]: KEP-6061 - OCI Artifact-Based Security Profile Distribution
KEP/SIG-Node References
- KEP(s): KEP-6061
- stage: alpha
- KEP Issue: https://github.com/kubernetes/enhancements/issues/6061
- KEP PR: https://github.com/kubernetes/enhancements/pull/6062
- K8s-Release: v1.38
- KEP-Owner: @saschagrunert
- SIG-Node member liaison: @SergeyKanzhelev
- KEP-Shepherd: @mikebrow
What is the SIG-Node problem you are trying to solve
Kubernetes needs native support for pulling security profiles from OCI-compatible registries. Today, profiles must be pre-installed on every node (Localhost type), creating operational burden. KEP-6061 adds an OCI profile type to SeccompProfile (AppArmor follows in beta) and a PullSecurityProfile RPC to the CRI ImageService. The runtime merges every pulled profile with its configured baseline (and an optional pod-spec base profile) via intersection at apply time, so an OCI profile can never be more permissive than the node baseline. References are digest-pinned; mutable tags are a non-goal.
Describe the solution you would like
containerd work for alpha (design details in the KEP PR):
-
ImageService.PullSecurityProfile: request mirrorsPullImage(ImageSpecwithruntime_handler,AuthConfig,PodSandboxConfig) plusprofile_kind; response carriescached. Pull-if-not-present: no registry contact when the digest is already present.profile_kindmust match the artifact's config media type (mismatch isSecurityProfileInvalid);SecurityProfileKindUnspecifiedand, until beta,AppArmorare rejected withInvalidArgument. - Artifact validation at pull time: config media type
application/vnd.cncf.seccomp-profile.config.v1+json(orartifactTypewith the OCI 1.1 empty config), exactly one layer, raw JSON blob (not tar; do not require a specific layer media type), size limit (1 MiB default), and content validation: decode with the merge library'sUnmarshalStrict(refuses repeated, unknown and case-misspelled members, invalid UTF-8, and trailing data), thenValidateArtifact(rejectsSCMP_ACT_NOTIFY, the listener settingslistenerPath,listenerMetadataandSECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV, errno values above 4095, argument values above 32 bits when a 32-bit architecture is covered, rules for one syscall that libseccomp refuses to load together, and profiles past its four limits (128 entries per syscall, 256 rules per syscall, 1024 names per entry, 16384 rules per profile)). - Well-known errors from
k8s.io/cri-api/pkg/errors: reuseRegistryUnavailableandSignatureValidationFailed, return the newSecurityProfileInvalidfor permanent rejection. -
SecurityProfile.profile_type = OCIwithoci_refand optionalbase_profileinRunPodSandbox/CreateContainer; merge order is runtime baseline, then base profile, then OCI profile viaseccomp.Intersect, which handles the native architecture itself (no caller preparation); load the merge result, never the artifact as pulled.oci_refcarries the pod spec reference; accept it even when a mirror served the content. - Baseline configuration (RuntimeDefault or a profile on disk), validated at config load.
- Report
security_profile_ociinRuntimeFeatures. - Storage: eviction is a runtime decision (it costs a re-pull, not a failed pod), but keep profiles referenced by an existing sandbox or container, since the kubelet re-pulls on every sync; never list profile artifacts in
ListImages; expose artifact count and size metrics (no kubelet-driven GC until beta). - Observability: warning log with a well-known message identifier when the merge constrains an OCI profile, plus a metric counting constrained merges.
- Signature policy applied to profile pulls like image volumes.
- Snapshotter
ImageServiceproxies (stargz, nydus, overlaybd) need to forward the new method; until then they answerUnimplemented, which the kubelet treats as permanent and fails the pod. Transparent forwarding of unknown methods would avoid a proxy release per new RPC. - critest coverage for the RPC, validation, merge, and errors.
Additional context
CRI-O has shipped annotation-based OCI artifact support for seccomp profiles since v1.30; its implementation of this KEP is tracked in https://github.com/cri-o/cri-o/issues/10037. The RPC is on ImageService (not RuntimeService) so that snapshotters can forward credentials through their existing ImageService proxy. Merge library: moved to https://github.com/kubernetes-sigs/security-profiles-merger as a SIG Node subproject; import sigs.k8s.io/security-profiles-merger, and v0.6.0 is the version to pin: it ships seccomp.UnmarshalStrict, seccomp.ValidateArtifact with its limits, and merge semantics checked against libseccomp, runc, and crun, including 32-bit argument comparison and socketcall/ipc multiplexing (so the merge result depends on the node's architecture and runs on the node), and the KEP's merge text follows it. The runtime flow is described in https://github.com/kubernetes-sigs/security-profiles-merger/blob/v0.6.0/docs/integration.md, so nothing blocks the integration on the library side. Kubelet prerequisite: https://github.com/kubernetes/kubernetes/pull/141958, merged for v1.38.
Source: containerd/containerd