All Products
Search
Document Center

Elastic Container Instance:Automatically evict pods whose temporary storage spaces are insufficient

最終更新日:Oct 27, 2023

This topic describes how to automatically evict pods whose temporary storage spaces are insufficient in Kubernetes scenarios. This ensures sufficient temporary storage spaces for your business operation.

Configuration description

By default, when the temporary storage space of an Elastic Container Instance-based pod is insufficient, the system does not handle this situation. The insufficiency of the temporary storage space of the pod may affect the operation of your business. Elastic Container Instance allows you to add the k8s.aliyun.com/eci-eviction-enable: "true" annotation based on the eviction and scheduling mechanisms of Kubernetes. If the temporary storage space of a pod is less than 100 MiB, the system automatically evicts the pod. The status of the pod changes to Failed.

Important
  • Annotations must be added to the metadata in the configuration file of the pod. For example, when you create a Deployment, you must add annotations in the spec.template.metadata section.

  • To use features of Elastic Container Instance, you can add annotations only when you create Elastic Container Instance-based pods. If you add or modify annotations when you update pods, these annotations do not take effect.

Typically, business applications are deployed on Deployments. If the pod to be evicted is managed by a Deployment, the Deployment automatically creates a new pod, as shown in the following figure. 驱逐

Configuration example

apiVersion: apps/v1
kind: Deployment
metadata:
  name: test
  labels:
    app: nginx
spec:
  replicas: 4
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      name: nginx-test
      annotations:
        k8s.aliyun.com/eci-eviction-enable: "true" # Specifies to automatically evict pods whose temporary storage spaces are insufficient.
      labels:
        app: nginx
        alibabacloud.com/eci: "true" 
    spec:
      containers:
      - name: nginx
        image: registry.cn-shanghai.aliyuncs.com/eci_open/nginx:1.14.2