Sobes.tech
Middle

What does the term 'eviction' or 'evict' mean in the context of DevOps?

sobes.tech AI

Answer from AI

In the context of DevOps, especially when working with container orchestration systems like Kubernetes, "eviction" (or the "evict" process) refers to the forced eviction (removal) of a Pod from a node.

This usually occurs due to resource shortages on the node, such as:

  • Disk space: The node is close to exhausting the disk space needed for Pods, logs, container images, etc.
  • Memory: The system on the node is running out of RAM.

When the node reaches a certain threshold of resource usage (configured in Kubelet), the Kubelet begins the eviction process to prevent a complete node failure and maintain stability. Eviction priority is given to Pods with lower PriorityClass and those consuming more resources than requested limits (burstable or best-effort QoS).

// Example Pod manifest with specified resources
apiVersion: v1
kind: Pod
metadata:
  name: my-pod
spec:
  containers:
  - name: my-container
    image: nginx
    resources:
      requests:
        memory: "64Mi"
        cpu: "250m"
      limits:
        memory: "128Mi"
        cpu: "500m"
  priorityClassName: high-priority // Example of using PriorityClass

An evicted Pod is marked as Evicted, after which a controller (e.g., Deployment) creates a new Pod instance on another node with sufficient resources.

Managing eviction thresholds is an important part of maintaining cluster stability. This is configured through Kubelet parameters such as:

  • --eviction-hard
  • --eviction-soft
  • --eviction-pressure-transition-period

Monitoring resource usage on nodes and configured eviction policies help prevent performance degradation and application failures.