Get the App
SLTechnology News&Howtos  ›  Servers  › 

What is the working mechanism of Kubernetes Eviction Manager

Shulou Source: shulou.com Published: 2022-05-31 18:01:54 09月15日 Update

This article mainly explains "what is the working mechanism of Kubernetes Eviction Manager". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the working mechanism of Kubernetes Eviction Manager".

First, let's talk about the disadvantages of kubelet recycling resources through OOM Killer:

System OOM events is inherently resource-sensitive, and it stall the Node until the OOM Killing Process is completed.

When OOM Killer kills some containers, kubernetes Scheduler may soon dispatch a new Pod to the Node or container directly restart on the node, and immediately trigger the OOM Killer on the Node to start OOM Killing Process, and things may go on endlessly, which is not good.

Let's take a look at how Kubelet Eviction is different:

Kubelet monitors and prevents resource exhaustion on the Node through pro-actively. Once Eviction Signals is triggered, it will directly Fail one or more Pod to recover resources, rather than through resource-consuming components such as Linux OOM Killer.

This kind of Eviction Signals is configurable and Pro-actively can be achieved.

In addition, the Evicted Pods will be rescheduled on other Node without triggering the Eviction again on this Node.

Next, let's take a specific look at how Kubelet Eviction Policy works.

Kubelet monitors the resource usage of this node in advance and prevents resources from being exhausted, thus ensuring the stability of node.

Kubelet Fail N (> = 1) Pod in advance to recover resources that are in short supply.

When kubelet Fail a Node, it will kill all Containners in the Pod and set PodPhase to Failed.

Kubelet triggers the Eviction action to recycle resources by artificially setting Eviction Thresholds in advance.

Eviction Signals

The following Eviction Signals are supported:

Eviction SignalDescriptionmemory.availablememory.available: = node.status.capacity [memory]-node.stats.memory.workingSetnodefs.availablenodefs.available: = node.stats.fs.availablenodefs.inodesFreenodefs.inodesFree: = node.stats.fs.inodesFreeimagefs.availableimagefs.available: = node.stats.runtime.imagefs.availableimagefs.inodesFreeimagefs.inodesFree: = node.stats.runtime.imagefs.inodesFree

Kubelet currently supports two kinds of filesystem, of which imagefs is optional. Kubelet automatically discovers these filesystem through cAdvisor.

Nodefs-Kubelet is used to store data such as volume,logs.

Imagefs-the Writable Layer used by the container runtime (dockerd/rkt, etc.) to hold images and containers.

Eviction Thresholds

As mentioned earlier, kubelet triggers the Eviction action to recycle resources by artificially setting Eviction Thresholds in advance.

The form of Eviction Thresholds is:

Quantity supports both absolute and relative percentages, such as:

Memory.available

Tags: Resource configuration monitoring container mechanism memory situation work that is e.g.Action scheduling content again cycle soon data time threshold right away Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux MySQL Huawei vpn NVidia