mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +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
|
||||
|
||||
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.
|
||||
if runOnce {
|
||||
|
@ -22,6 +22,6 @@ import (
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
func RlimitNumFiles(maxOpenFiles uint64) {
|
||||
unix.Setrlimit(unix.RLIMIT_NOFILE, &unix.Rlimit{Max: maxOpenFiles, Cur: maxOpenFiles})
|
||||
func RlimitNumFiles(maxOpenFiles uint64) error {
|
||||
return unix.Setrlimit(unix.RLIMIT_NOFILE, &unix.Rlimit{Max: maxOpenFiles, Cur: maxOpenFiles})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user