Eviction Policy — control when Pods are evicted.
1# Node with eviction thresholds2apiVersion: v13kind: Node4metadata:5 name: node-16spec:7 unschedulable: false8---9# Pod with priority (higher = harder to evict)10apiVersion: v111kind: Pod12metadata:13 name: critical-pod14spec:15 priorityClassName: critical16 containers:17 - name: app18 image: myapp:latest19 resources:20 requests:21 cpu: "1"22 memory: "2Gi"23 limits:24 cpu: "2"25 memory: "4Gi"26---27# PodDisruptionBudget28apiVersion: policy/v129kind: PodDisruptionBudget30metadata:31 name: myapp-pdb32spec:33 minAvailable: 234 selector:35 matchLabels:36 app: myapp37 unhealthyPodEvictionPolicy: AlwaysAllow
1# Check eviction events2kubectl get events --field-selector reason=Evicted --sort-by=.lastTimestamp34# Check node conditions5kubectl get nodes -o custom-columns=NAME:.metadata.name,MEMORY_PRESSURE:.status.conditions[?(@.type=="MemoryPressure")].status,DISK_PRESSURE:.status.conditions[?(@.type=="DiskPressure")].status,PID_PRESSURE:.status.conditions[?(@.type=="PIDPressure")].status67# Check eviction thresholds8kubectl describe node node-1 | grep -A 10 "Allocated resources"910# Check Pod priority11kubectl get pods --sort-by=.spec.priority -A1213# Check PDB status14kubectl get pdb15kubectl describe pdb myapp-pdb1617# View evicted Pods18kubectl get pods --field-selector status.phase=Failed -A | grep Evicted
Eviction Types:
Eviction Priority: