What is the difference between "allocatable cpu" and "allocated cpu limit" on a GKE cluster node

9/13/2019

When I do

kubectl describe node <node-name> | grep cpu

on my Google Kubernetes Cluster I do get

cpu:                        1
cpu:                        940m
cpu                        709m (75%)   2156m (229%)

My question is about the difference of the last number in line two (940m) and the last number in line three (2156m). The latter is the the limit of the allocated resources:

Allocated resources:
  (Total limits may be over 100 percent, i.e., overcommitted.)
  Resource                   Requests     Limits
  --------                   --------     ------
  cpu                        709m (75%)   2156m (229%)

The former is the allocatable cpu

Allocatable:
 attachable-volumes-gce-pd:  128
 cpu:                        940m

What is the difference between these two numbers? Why are they not the same? And what is the relevant limit that decides if a pod can be started on the node or not?

-- asmaier
cpu-usage
google-kubernetes-engine
kubernetes

2 Answers

9/13/2019

In a nutshell

  • 940m is the number of millicores your pod uses.
  • 2156m is the number of millicores usable before killing your pod for excessive use of CPU.

More in depth, it is how the architecture is designed, when a process requests memory and CPU takes into consideration the type of machine (bare metal or cloud, and which cloud) how node pools were defined and how much resources those node pools have to provide them to the pods (deployment sets and so forth); this also takes into consideration overhead and system usage.

If you would like to know more I am adding to links to this answer so you can check them out, they are quite useful.

Have an awesome day!

[1] https://cloud.google.com/kubernetes-engine/docs/concepts/cluster-architecture

[2] https://unofficial-kubernetes.readthedocs.io/en/latest/concepts/configuration/manage-compute-resources-container/

-- JorgeHPM
Source: StackOverflow

9/15/2019

Allocatable is the amount of resources available to the pods to consume, 940m cpu in your example.

The allocated limit is the sum of all the pod limits defined in pods running on the node. The allocatable and the resource requested are more useful

-- Patrick W
Source: StackOverflow