mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-07 11:13:48 +00:00
Merge pull request #125138 from AkihiroSuda/fix-125137
kubelet: fix `Turning off swap in unprivileged tmpfs mounts unsupported`
This commit is contained in:
commit
d145bf0907
@ -26,6 +26,7 @@ import (
|
||||
|
||||
"k8s.io/apimachinery/pkg/util/version"
|
||||
"k8s.io/klog/v2"
|
||||
"k8s.io/kubernetes/pkg/kubelet/userns/inuserns"
|
||||
utilkernel "k8s.io/kubernetes/pkg/util/kernel"
|
||||
"k8s.io/mount-utils"
|
||||
)
|
||||
@ -46,6 +47,14 @@ func IsTmpfsNoswapOptionSupported(mounter mount.Interface, mountPath string) boo
|
||||
return false
|
||||
}
|
||||
|
||||
if inuserns.RunningInUserNS() {
|
||||
// Turning off swap in unprivileged tmpfs mounts unsupported
|
||||
// https://github.com/torvalds/linux/blob/v6.8/mm/shmem.c#L4004-L4011
|
||||
// https://github.com/kubernetes/kubernetes/issues/125137
|
||||
klog.InfoS("Running under a user namespace - tmpfs noswap is not supported")
|
||||
return false
|
||||
}
|
||||
|
||||
kernelVersion, err := utilkernel.GetVersion()
|
||||
if err != nil {
|
||||
klog.ErrorS(err, "cannot determine kernel version, unable to determine is tmpfs noswap is supported")
|
||||
|
Loading…
Reference in New Issue
Block a user