Kubernetes
eviction signals
imagefs.available
nodefs.available
resource management

How does kubernetes get the imagefs.available and nodefs.available eviction signals?

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

Kubernetes is a robust container orchestration platform that automates the deployment, scaling, and management of containerized applications. For efficient resource management, Kubernetes implements a mechanism to evict pods from nodes to manage resource exhaustion. One critical aspect of this is handling storage resources, which is done using eviction signals like `imagefs.available` and `nodefs.available`.

Understanding the Eviction Mechanism

The eviction process in Kubernetes relies on monitoring resource availability and deciding when to take action to recover from resource starvation. This is crucial to ensure that the workloads remain healthy and the node stays operational. Kubernetes uses eviction signals to trigger the eviction of pods. Two of the key eviction signals related to storage are:

  • `imagefs.available`: This indicates the available storage space for storing container images on the node.
  • `nodefs.available`: This represents the available storage space on the root filesystem of the node, which is used by the operating system and daemon processes along with Kubernetes.

How Kubernetes Monitors Storage

Kubernetes leverages the Kubelet, a key component that runs on each node, to monitor the node's resource usage continuously. The Kubelet is responsible for communicating with the container runtime and retrieving metrics related to available storage. For storage monitoring, this involves:

  • Configuring Thresholds: Admins can set soft and hard thresholds on eviction signals. A "soft" eviction threshold allows for a grace period before evicting, while a "hard" threshold triggers immediate eviction when crossed.
  • Polling Interval: The Kubelet polls the node's storage usage at regular intervals. By default, this is every 10 seconds.
  • Calculating Storage Usage:
    • For `imagefs.available`, the Kubelet will query the container runtime to get metrics on available space on the storage medium holding the container images.
    • For `nodefs.available`, it polls the root filesystem's available space using standard system tools and interfaces.
  • `imagefs.available`: 15% hard threshold and 20% soft threshold with a grace period of 1 minute.
  • `nodefs.available`: 10% hard threshold and 15% soft threshold with a grace period of 2 minutes.

Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

All Rights Reserved.