Skip to content

Commit cd26139

Browse files
authored
Merge pull request #95890 from jluk/master
add eviction value for reserved mem
2 parents a0f3998 + 958af66 commit cd26139

File tree

2 files changed

+33
-17
lines changed

2 files changed

+33
-17
lines changed

articles/aks/concepts-clusters-workloads.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,24 +83,32 @@ kubectl describe node [NODE_NAME]
8383
To maintain node performance and functionality, resources are reserved on each node by AKS. As a node grows larger in resources, the resource reservation grows due to a higher amount of user deployed pods needing management.
8484

8585
>[!NOTE]
86-
> Using add-ons such as OMS will consume additional node resources.
86+
> Using AKS add-ons such as Container Insights (OMS) will consume additional node resources.
8787
8888
- **CPU** - reserved CPU is dependent on node type and cluster configuration which may cause less allocatable CPU due to running additional features
8989

9090
| CPU cores on host | 1 | 2 | 4 | 8 | 16 | 32|64|
9191
|---|---|---|---|---|---|---|---|
9292
|Kube-reserved (millicores)|60|100|140|180|260|420|740|
9393

94-
- **Memory** - reservation of memory follows a progressive rate
95-
- 25% of the first 4 GB of memory
96-
- 20% of the next 4 GB of memory (up to 8 GB)
97-
- 10% of the next 8 GB of memory (up to 16 GB)
98-
- 6% of the next 112 GB of memory (up to 128 GB)
99-
- 2% of any memory above 128 GB
94+
- **Memory** - reserved memory includes the sum of two values
10095

101-
These reservations mean that the amount of available CPU and memory for your applications may appear less than the node itself contains. If there are resource constraints due to the number of applications that you run, these reservations ensure CPU and memory remains available for the core Kubernetes components. The resource reservations can't be changed.
96+
1. The kubelet daemon is installed on all Kubernetes agent nodes to manage container creation and termination. By default on AKS, this daemon has the following eviction rule: memory.available<750Mi, which means a node must always have at least 750 Mi allocatable at all times. When a host is below that threshold of available memory, the kubelet will terminate one of the running pods to free memory on the host machine and protect it.
10297

103-
The underlying node OS also requires some amount of CPU and memory resources to complete its own core functions.
98+
2. The second value is a progressive rate of memory reserved for the kubelet daemon to properly function (kube-reserved).
99+
- 25% of the first 4 GB of memory
100+
- 20% of the next 4 GB of memory (up to 8 GB)
101+
- 10% of the next 8 GB of memory (up to 16 GB)
102+
- 6% of the next 112 GB of memory (up to 128 GB)
103+
- 2% of any memory above 128 GB
104+
105+
As a result of these two defined rules imposed to keep Kubernetes and agent nodes healthy, the amount of allocatable CPU and memory will appear less than the node itself could offer. The resource reservations defined above cannot be changed.
106+
107+
For example, if a node offers 7 GB, it will report 34% of memory not allocatable:
108+
109+
`750Mi + (0.25*4) + (0.20*3) = 0.786GB + 1 GB + 0.6GB = 2.386GB / 7GB = 34% reserved`
110+
111+
In addition to reservations for Kubernetes, the underlying node OS also reserves an amount of CPU and memory resources to maintain OS functions.
104112

105113
For associated best practices, see [Best practices for basic scheduler features in AKS][operator-best-practices-scheduler].
106114

articles/aks/developer-best-practices-resource-management.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ author: zr-msft
66

77
ms.service: container-service
88
ms.topic: conceptual
9-
ms.date: 11/26/2018
9+
ms.date: 11/13/2019
1010
ms.author: zarhoads
1111
---
1212

@@ -27,16 +27,24 @@ This best practices article focuses on how to run your cluster and workloads fro
2727

2828
A primary way to manage the compute resources within an AKS cluster is to use pod requests and limits. These requests and limits let the Kubernetes scheduler know what compute resources a pod should be assigned.
2929

30-
* **Pod requests** define a set amount of CPU and memory that the pod needs. These requests should be the amount of compute resources the pod needs to provide an acceptable level of performance.
31-
* When the Kubernetes scheduler tries to place a pod on a node, the pod requests are used to determine which node has sufficient resources available.
32-
* Monitor the performance of your application to adjust these requests to make sure you don't define less resources that required to maintain an acceptable level of performance.
33-
* **Pod limits** are the maximum amount of CPU and memory that a pod can use. These limits help prevent one or two runaway pods from taking too much CPU and memory from the node. This scenario would reduce the performance of the node and other pods that run on it.
30+
* **Pod CPU/Memory requests** define a set amount of CPU and memory that the pod needs on a regular basis.
31+
* When the Kubernetes scheduler tries to place a pod on a node, the pod requests are used to determine which node has sufficient resources available for scheduling.
32+
* Not setting a pod request will default it to the limit defined.
33+
* It is very important to monitor the performance of your application to adjust these requests. If insufficient requests are made, your application may receive degraded performance due to over scheduling a node. If requests are overestimated, your application may have increased difficulty getting scheduled.
34+
* **Pod CPU/Memory limits** are the maximum amount of CPU and memory that a pod can use. These limits help define which pods should be killed in the event of node instability due to insufficient resources. Without proper limits set pods will be killed until resource pressure is lifted.
35+
* Pod limits help define when a pod has lost of control of resource consumption. When a limit is exceeded, the pod is prioritized for killing to maintain node health and minimize impact to pods sharing the node.
36+
* Not setting a pod limit defaults it to the highest available value on a given node.
3437
* Don't set a pod limit higher than your nodes can support. Each AKS node reserves a set amount of CPU and memory for the core Kubernetes components. Your application may try to consume too many resources on the node for other pods to successfully run.
35-
* Again, monitor the performance of your application at different times during the day or week. Determine when the peak demand is, and align the pod limits to the resources required to meet the application's needs.
38+
* Again, it is very important to monitor the performance of your application at different times during the day or week. Determine when the peak demand is, and align the pod limits to the resources required to meet the application's max needs.
3639

37-
In your pod specifications, it's best practice to define these requests and limits. If you don't include these values, the Kubernetes scheduler doesn't understand what resources are needed. The scheduler may schedule the pod on a node without sufficient resources to provide acceptable application performance. The cluster administrator may set *resource quotas* on a namespace that requires you to set resource requests and limits. For more information, see [resource quotas on AKS clusters][resource-quotas].
40+
In your pod specifications, it's **best practice and very important** to define these requests and limits based on the above information. If you don't include these values, the Kubernetes scheduler cannot take into account the resources your applications require to aid in scheduling decisions.
3841

39-
When you define a CPU request or limit, the value is measured in CPU units. *1.0* CPU equates to one underlying virtual CPU core on the node. The same measurement is used for GPUs. You can also define a fractional request or limit, typically in millicpu. For example, *100m* is *0.1* of an underlying virtual CPU core.
42+
If the scheduler places a pod on a node with insufficient resources, application performance will be degraded. It is highly recommended for cluster administrators to set *resource quotas* on a namespace that requires you to set resource requests and limits. For more information, see [resource quotas on AKS clusters][resource-quotas].
43+
44+
When you define a CPU request or limit, the value is measured in CPU units.
45+
* *1.0* CPU equates to one underlying virtual CPU core on the node.
46+
* The same measurement is used for GPUs.
47+
* You can define fractions measured in millicores. For example, *100m* is *0.1* of an underlying vCPU core.
4048

4149
In the following basic example for a single NGINX pod, the pod requests *100m* of CPU time, and *128Mi* of memory. The resource limits for the pod are set to *250m* CPU and *256Mi* memory:
4250

0 commit comments

Comments
 (0)