I'm testing GKE with their default monitoring charts.
Cluster summary say each node (n2-custom-4-8192) have 6.36 GB Memory allocatable.
In the node details page, I can see the peak "Used" is 4.19 when the pod get killed.
![](../../users/profiles/92669.webp)
- 257
- 1
- 2
- 7
1 Answers
In this case everything working as intended. I guess you missed information about Eviction threshold
.
Allocatable
is the value of Capacity
minus Reserved
and Eviction Threshold
.
In GKE
documentation Node allocatable resources you can find information about resource allocation.
Some of a node's resources are required to run the
GKE
and Kubernetes node components necessary to make that node function as part of yourcluster
. As such, you may notice a disparity between your node's total resources (as specified in the machine type documentation) and the node'sallocatable
resources inGKE
. As larger machine types tend to run morecontainers
(and by extension, more Pods), the amount of resources thatGKE
reserves forKubernetes components
scales upward for larger machines.Windows Server nodes
also requiremore resources
than a typicalLinux node
. The nodes need the extra resources to account for running the Windows OS and for the Windows Server components that can't run in containers.
To inspect the node allocatable resources available in a cluster, run the following command:
$ kubectl describe node ${NodeName} | grep Allocatable -B 7 -A 6
The returned output contains Capacity and Allocatable fields with measurements for ephemeral storage, memory, and CPU.
If you will scroll a bit lower to Allocatable memory and CPU resources you will read that allocatable resources are calculated in the following way:
Allocatable = Capacity - Reserved - Eviction Threshold
For memory resources, GKE reserves the following:
- 255 MiB of memory for machines with less than 1 GB of memory
- 25% of the first 4GB of memory
- 20% of the next 4GB of memory (up to 8GB)
- 10% of the next 8GB of memory (up to 16GB)
- 6% of the next 112GB of memory (up to 128GB)
- 2% of any memory above 128GB
![](../../users/profiles/513968.webp)
- 615
- 3
- 11
-
thanks you, I indeed missing k8s Eviction Threshold – nvcnvn Aug 27 '20 at 09:07