kubernetes: App Containers can't inherit Init Containers CPUs - CPU Manager Static Policy

What happened:. CPU Manager was configured with static policy. AppContainer couldn’t be placed on the same NUMA node as InitContainer, thus couldn’t inherit CPUs used by InitContainer, so it ended up with multi NUMA locality hint generated (ex. [11-false]). This can cause a pod rejection, depending on Topology Manager policy.

What you expected to happen: AppContainer to be placed on the same NUMA node as InitContainer, if there is enough resources (and inherit InitContainer CPUs). If not, it should be placed on another NUMA node and CPUs used by InitContainer should be released back to the pool.

How to reproduce it (as minimally and precisely as possible): Leave small amount of free CPUs on NUMA0, enough to fit InitContainer, but not enough to fit AppContainer. On NUMA1 there should be enough CPUs to fit AppContainer.

Anything else we need to know?: Part of the code that is responsible for discarding other hints: https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/cm/cpumanager/policy_static.go#L384-L392

Environment:

  • Kubernetes version (use kubectl version): v1.19.0-rc.4.190+436f1afaf30c22
  • Cloud provider or hardware configuration:
  • OS (e.g: cat /etc/os-release):
  • Kernel (e.g. uname -a):
  • Install tools:
  • Network plugin and version (if this is a network-related bug):
  • Others:

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 1
  • Comments: 32 (22 by maintainers)

Most upvoted comments

The initContainer does not need to be tied to the core and can avoid leaks.

initContainers:
  - name: init
    image: nginx
    resources:
      requests:
        cpu: "0.1"
        memory: "10Mi"
      limits:
        cpu: "0.1"
        memory: "10Mi"
  containers:
  - name: main
    image: nginx
    resources:
      requests:
        cpu: "1"
        memory: "10Mi"
      limits:
        cpu: "1"
        memory: "10Mi"

@k-wiatrzyk