mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
add error handler of unix.Setrlimit
This commit is contained in:
parent
63411a137f
commit
2a83443782
@ -1100,7 +1100,9 @@ func RunKubelet(kubeServer *options.KubeletServer, kubeDeps *kubelet.Dependencie
|
|||||||
}
|
}
|
||||||
podCfg := kubeDeps.PodConfig
|
podCfg := kubeDeps.PodConfig
|
||||||
|
|
||||||
rlimit.RlimitNumFiles(uint64(kubeServer.MaxOpenFiles))
|
if err := rlimit.RlimitNumFiles(uint64(kubeServer.MaxOpenFiles)); err != nil {
|
||||||
|
klog.Warningf("Failed to set open file handler limit: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
// process pods and exit.
|
// process pods and exit.
|
||||||
if runOnce {
|
if runOnce {
|
||||||
|
@ -22,6 +22,6 @@ import (
|
|||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
|
||||||
func RlimitNumFiles(maxOpenFiles uint64) {
|
func RlimitNumFiles(maxOpenFiles uint64) error {
|
||||||
unix.Setrlimit(unix.RLIMIT_NOFILE, &unix.Rlimit{Max: maxOpenFiles, Cur: maxOpenFiles})
|
return unix.Setrlimit(unix.RLIMIT_NOFILE, &unix.Rlimit{Max: maxOpenFiles, Cur: maxOpenFiles})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user