kuberneteskubectl

Allocated Resources percentage in "kubectl top node"


Doing a kubectl describe node I get:

[...]
Allocated resources:
  (Total limits may be over 100 percent, i.e., overcommitted.)
  Resource           Requests       Limits
  --------           --------       ------
  cpu                14095m (56%)   48794m (195%)
  memory             28669Mi (12%)  50824Mi (21%)
  ephemeral-storage  22342Mi (41%)  34558Mi (64%)
  hugepages-1Gi      0 (0%)         0 (0%)
  hugepages-2Mi      0 (0%)         0 (0%)

Which "total" value is it taking for calculating the percentage for each of the resources?

For example, I'm taking the cpu Request value by summing all the values from the previous "CPU Request" in the "Non-terminated Pods" section, but I realized the percentage is not the direct result of summing each of the corresponding pods percentages.


Solution

  • In Kubernetes, the percentages displayed in the kubectl describe node command under Allocated resources are calculated based on the node's total available resources. The percentages represent how much of the node's total CPU, memory, ephemeral storage, or hugepages resources are requested or limited by the pods running on that node.

    The percentages shown are calculated based on the allocatable values of the node, i.e. available after reserving resources for K8S and system components.

    In you case :