mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
Merge pull request #86752 from SataQiu/fix-kubelet-20191231
Add error handler for rlimit.RlimitNumFiles
This commit is contained in:
commit
ad4bd386eb
@ -1112,7 +1112,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.Errorf("Failed to set rlimit on max file handles: %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