mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
kubelet/cm: ignore sysctl error when running in userns
Errors during setting the following sysctl values are ignored: - vm.overcommit_memory - vm.panic_on_oom - kernel.panic - kernel.panic_on_oops - kernel.keys.root_maxkeys - kernel.keys.root_maxbytes Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
parent
b16323e37c
commit
dbe0155139
@ -39,6 +39,7 @@ import (
|
|||||||
utilpath "k8s.io/utils/path"
|
utilpath "k8s.io/utils/path"
|
||||||
|
|
||||||
libcontainerdevices "github.com/opencontainers/runc/libcontainer/devices"
|
libcontainerdevices "github.com/opencontainers/runc/libcontainer/devices"
|
||||||
|
libcontaineruserns "github.com/opencontainers/runc/libcontainer/userns"
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/resource"
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
utilerrors "k8s.io/apimachinery/pkg/util/errors"
|
utilerrors "k8s.io/apimachinery/pkg/util/errors"
|
||||||
@ -455,6 +456,13 @@ func setupKernelTunables(option KernelTunableBehavior) error {
|
|||||||
klog.V(2).InfoS("Updating kernel flag", "flag", flag, "expectedValue", expectedValue, "actualValue", val)
|
klog.V(2).InfoS("Updating kernel flag", "flag", flag, "expectedValue", expectedValue, "actualValue", val)
|
||||||
err = sysctl.SetSysctl(flag, expectedValue)
|
err = sysctl.SetSysctl(flag, expectedValue)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if libcontaineruserns.RunningInUserNS() {
|
||||||
|
if utilfeature.DefaultFeatureGate.Enabled(kubefeatures.KubeletInUserNamespace) {
|
||||||
|
klog.V(2).InfoS("Updating kernel flag failed (running in UserNS, ignoring)", "flag", flag, "err", err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
klog.ErrorS(err, "Updating kernel flag failed (Hint: enable KubeletInUserNamespace feature flag to ignore the error)", "flag", flag)
|
||||||
|
}
|
||||||
errList = append(errList, err)
|
errList = append(errList, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user