K8S Performance Optimization - K8S Node Parameter Tuning
This article was last updated on: July 24, 2024 am
preface
This is the fourth article in a series on K8S performance optimization: Best practices for Kubernetes node performance optimization parameters.
Series:
- K8S Performance Optimization - OS sysctl Tuning
- 《K8S Performance Optimization - K8S APIServer Tuning》
- K8S Performance Optimization - CIDR Configuration for Large Clusters
Two parameters
Two parameters that control the maximum number of pods that can be scheduled for a K8S Node: podsPerCore
and maxPods
。
When both parameters are set, the smaller value limits the number of pods on the node. Exceeding these values can cause:
- CPU usage increases.
- Slow down pod scheduling.
- Depending on the amount of memory in the node, memory exhaustion can occur.
- Exhaust the IP address pool.
- Overuse of resources, resulting in poor user application performance.
⚠️ significant
In Kubernetes, a pod with a single container actually uses two containers. The second container is used to set up pause before the actual container starts. So, a system running 10 pods would actually run 20 containers.
podsPerCore
Set the number of pods that a node can run based on the number of processor cores in the node. For example: on a node with 4 processor cores podsPerCore
Set to 10 to allow the maximum number of pods allowed on that node to be 40.
1 |
|
will podsPerCore
Set to 0
You can disable this restriction. The default is 0
。podsPerCore
Can’t exceed maxPods
。
maxPods
Set the number of pods that a node can run to a fixed value, regardless of the node’s properties.
1 |
|
EOF