Skip to content

Commit 1e53e59

Browse files
committed
Revert "Enforce the Minimum Kernel Version 6.3 for UserNamespacesSupport feature"
This reverts commit 8597b34. I wrote in the Kubernetes documentation: In practice this means you need at least Linux 6.3, as tmpfs started supporting idmap mounts in that version. This is usually needed as several Kubernetes features use tmpfs (the service account token that is mounted by default uses a tmpfs, Secrets use a tmpfs, etc.) The check is wrong for several reasons: * Pods can use userns before 6.3, they will just need to be careful to not use a tmpfs (like a serviceaccount). MOST users will probably need 6.3, but it is possible to use earlier kernel versions. 5.19 probably works fine and with improvements in the runtime 5.12 can probably be supported too. * Several distros backport changes and the recommended way is usually to try the syscall instead of testing kernel versions. I expect support for simple fs like tmpfs will be backported in several distros, but with this check it can generate confusion. * Today a clear error is shown when the pod is created, so it's unlikely a user will not understand why it fails. * Returning an error if utilkernel fails to understand what kernel version is running is also too strict (as we are logging a warning even if it is not the expected version) * We are switching to enabled by default, which will log a warning on every user that runs on an older than 6.3 kernel, adding noise to the logs. For there reasons, let's just remove the hardcoded kernel version check. Signed-off-by: Rodrigo Campos <[email protected]>
1 parent c88aef2 commit 1e53e59

File tree

2 files changed

+0
-17
lines changed

2 files changed

+0
-17
lines changed

pkg/kubelet/kubelet_pods.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import (
4141
"k8s.io/apimachinery/pkg/types"
4242
"k8s.io/apimachinery/pkg/util/sets"
4343
utilvalidation "k8s.io/apimachinery/pkg/util/validation"
44-
"k8s.io/apimachinery/pkg/util/version"
4544
utilfeature "k8s.io/apiserver/pkg/util/feature"
4645
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"
4746
"k8s.io/klog/v2"
@@ -62,7 +61,6 @@ import (
6261
"k8s.io/kubernetes/pkg/kubelet/status"
6362
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
6463
utilfs "k8s.io/kubernetes/pkg/util/filesystem"
65-
utilkernel "k8s.io/kubernetes/pkg/util/kernel"
6664
utilpod "k8s.io/kubernetes/pkg/util/pod"
6765
volumeutil "k8s.io/kubernetes/pkg/volume/util"
6866
"k8s.io/kubernetes/pkg/volume/util/hostutil"
@@ -131,17 +129,6 @@ func (kl *Kubelet) getKubeletMappings() (uint32, uint32, error) {
131129

132130
if !utilfeature.DefaultFeatureGate.Enabled(features.UserNamespacesSupport) {
133131
return defaultFirstID, defaultLen, nil
134-
} else {
135-
kernelVersion, err := utilkernel.GetVersion()
136-
if err != nil {
137-
return 0, 0, fmt.Errorf("failed to get kernel version, unable to determine if feature %s can be supported : %w",
138-
features.UserNamespacesSupport, err)
139-
}
140-
if kernelVersion != nil && !kernelVersion.AtLeast(version.MustParseGeneric(utilkernel.UserNamespacesSupportKernelVersion)) {
141-
return 0, 0, fmt.Errorf(
142-
"the kernel version (%s) is incompatible with the %s feature gate, which needs %s as a minimum kernel version",
143-
kernelVersion, features.UserNamespacesSupport, utilkernel.UserNamespacesSupportKernelVersion)
144-
}
145132
}
146133

147134
_, err := user.Lookup(kubeletUser)

pkg/util/kernel/constants.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ const TCPFinTimeoutNamespacedKernelVersion = "4.6"
4444
// (ref: https://github.com/torvalds/linux/commit/35dfb013149f74c2be1ff9c78f14e6a3cd1539d1)
4545
const IPVSConnReuseModeFixedKernelVersion = "5.9"
4646

47-
// UserNamespacesSupportKernelVersion is the kernel version where idmap for tmpfs support was added
48-
// (ref: https://github.com/torvalds/linux/commit/05e6295f7b5e05f09e369a3eb2882ec5b40fff20)
49-
const UserNamespacesSupportKernelVersion = "6.3"
50-
5147
const TmpfsNoswapSupportKernelVersion = "6.4"
5248

5349
// NFTablesKubeProxyKernelVersion is the lowest kernel version kube-proxy supports using

0 commit comments

Comments
 (0)