大网数据广告活动
服务器运维问答

Kube-Reserved/System-Reserved vs Eviction Threshold

· 52CE 我爱测

I'd like to properly prepare our self-managed clusters for resource pressure scenarios. From the docs I cannot understand the need for configuring the --eviction-hard parameter, when we can achieve the same effect by setting up p…

问题原文

原帖链接 · Bernard Halas · CC BY-SA 4.0

I'd like to properly prepare our self-managed clusters for resource pressure scenarios. From the docs I cannot understand the need for configuring the --eviction-hard parameter, when we can achieve the same effect by setting up proper values via --kube-reserved for kubelet and --system-reserved for system daemons.

Let me ask through an example. Why would I need to set the reservations for Kubelet and system-daemons, when seemingly it would suffice to configure --eviction-hard? Whenever there's a resource pressure in general this should be enough to trigger a pod eviction event. So what's the reason for the existence of the options for Kubelet and system-daemons reservations?

已采纳解答

原帖链接 · Dawid Kruk · CC BY-SA 4.0

As per official documentation:

Node Allocatable

'Allocatable' on a Kubernetes node is defined as the amount of compute resources that are available for pods. The scheduler does not over-subscribe 'Allocatable'. 'CPU', 'memory' and 'ephemeral-storage' are supported as of now.

The Node allocatable (the resources that scheduler can use to allocate the workload) can be defined as:

  • Node allocatable = Node capacity - kube-reserved - system-reserved

Also, as for:

  • kube-reserved:

kube-reserved is meant to capture resource reservation for kubernetes system daemons like the kubelet, container runtime, node problem detector, etc. It is not meant to reserve resources for system daemons that are run as pods. kube-reserved is typically a function of pod density on the nodes.

-- Kubernetes.io: Docs: Tasks: Administer cluster: Reserve compute resources: Kube reserved

  • system-reserved:

system-reserved is meant to capture resource reservation for OS system daemons like sshd, udev, etc. system-reserved should reserve memory for the kernel too since kernel memory is not accounted to pods in Kubernetes at this time. Reserving resources for user login sessions is also recommended (user.slice in systemd world).

-- Kubernetes.io: Docs: Tasks: Administer cluster: Reserve compute resources: System reserved

In short, you can easily imagine what would happen when you do not reserve enough resources for system components and the Kubelet.

You can even come to the situation where the eviction handler will not come to play because the system will already go into unstable state.

Also worth to mention that:

One thing that you can do with --kube-reserved and --system-reserved is to reserve the CPU needed for those components where the --eviction-hard is basing only on the memory and ephemeral storage.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2021-06-23)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。