From b65117884913d893a9d992b30b305fbc03338a33 Mon Sep 17 00:00:00 2001 From: Oleg Chunikhin Date: Sat, 15 Feb 2020 18:02:36 -0500 Subject: [PATCH] fix incorrect configuration of kubepods.slice unit by kubelet (issue #88197) --- pkg/kubelet/cm/node_container_manager_linux.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/kubelet/cm/node_container_manager_linux.go b/pkg/kubelet/cm/node_container_manager_linux.go index 29205730a39..96eb8bdfba0 100644 --- a/pkg/kubelet/cm/node_container_manager_linux.go +++ b/pkg/kubelet/cm/node_container_manager_linux.go @@ -38,10 +38,17 @@ const ( //createNodeAllocatableCgroups creates Node Allocatable Cgroup when CgroupsPerQOS flag is specified as true func (cm *containerManagerImpl) createNodeAllocatableCgroups() error { + nodeAllocatable := cm.internalCapacity + // Use Node Allocatable limits instead of capacity if the user requested enforcing node allocatable. + nc := cm.NodeConfig.NodeAllocatableConfig + if cm.CgroupsPerQOS && nc.EnforceNodeAllocatable.Has(kubetypes.NodeAllocatableEnforcementKey) { + nodeAllocatable = cm.getNodeAllocatableInternalAbsolute() + } + cgroupConfig := &CgroupConfig{ Name: cm.cgroupRoot, // The default limits for cpu shares can be very low which can lead to CPU starvation for pods. - ResourceParameters: getCgroupConfig(cm.internalCapacity), + ResourceParameters: getCgroupConfig(nodeAllocatable), } if cm.cgroupManager.Exists(cgroupConfig.Name) { return nil