TIL

Node-pressure Eviction

Self healing 동작

static Pod의 self healing

Eviction signals

Signal 의미 Linux 전용
memory.available 가용 메모리 = capacityworkingSet  
nodefs.available nodefs 가용 디스크  
nodefs.inodesFree nodefs 가용 inode
imagefs.available imagefs 가용 디스크  
imagefs.inodesFree imagefs 가용 inode
containerfs.available containerfs 가용 디스크  
containerfs.inodesFree containerfs 가용 inode
pid.available 가용 PID = maxpidcurproc

Memory signal 계산

Filesystem signal — nodefs / imagefs / containerfs

식별자 저장 대상
nodefs 노드 메인 FS — 로컬 볼륨, memory 아닌 emptyDir, 로그, ephemeral storage 등 (예: /var/lib/kubelet)
imagefs (선택) 컨테이너 이미지(read-only 레이어). containerfs가 없으면 writable 레이어도 여기 저장
containerfs (선택) 컨테이너 writable 레이어. 이걸 쓰면 imagefs는 이미지 전용으로 분리됨

Eviction thresholds

Soft eviction threshold

Hard eviction threshold

Signal 기본 threshold
memory.available <100Mi (Linux) / <500Mi (Windows)
nodefs.available <10%
imagefs.available <15%
nodefs.inodesFree <5% (Linux)
imagefs.inodesFree <5% (Linux)

Eviction 모니터링 주기

Node conditions

Node Condition 대응 signal 의미
MemoryPressure memory.available 가용 메모리가 threshold 도달
DiskPressure nodefs·imagefs·containerfs.available/.inodesFree 루트/이미지/컨테이너 FS의 가용 디스크·inode가 threshold 도달
PIDPressure pid.available (Linux) 가용 PID가 threshold 미만

Node condition oscillation

노드 레벨 리소스 회수 (Reclaiming node level resources)

파일시스템 구성 trigger FS → kubelet 회수 동작
nodefs만 (imagefs·containerfs 없음) nodefs: ① 죽은 Pod·컨테이너 GC → ② 미사용 이미지 삭제 (순서대로)
imagefs 분리 nodefs: 죽은 Pod·컨테이너 GC / imagefs: 모든 미사용 이미지 삭제
imagefs+containerfs 분리 containerfs: 죽은 Pod·컨테이너 GC / imagefs: 모든 미사용 이미지 삭제

Pod 선택 기준 (Pod selection for kubelet eviction)

순위 대상 정렬 기준
먼저 evict 사용량 > request인 BestEffort·Burstable Priority → request 초과량
나중 evict Guaranteed + 사용량 < request인 Burstable Priority

파일시스템 구성별 정렬 기준

구성 trigger FS → Pod 정렬 기준(사용량 집계)
nodefs=imagefs 동일 FS nodefs: 총 디스크 (로컬 볼륨 + 로그 + 전 컨테이너 쓰기 레이어)
nodefs·imagefs 분리 nodefs: 로컬 볼륨 + 로그 / imagefs: 전 컨테이너 쓰기 레이어
imagefs·containerfs 분리 containerfs: 로컬 볼륨 + 로그 + 쓰기 레이어 / imagefs: 이미지별 storage 사용량 순위

Minimum eviction reclaim

evictionHard:
  nodefs.available: "1Gi"
  imagefs.available: "100Gi"
evictionMinimumReclaim:
  nodefs.available: "500Mi"   # 1Gi 회복 후 500Mi 더 → 1.5Gi까지 회수
  imagefs.available: "2Gi"    # 102Gi까지 회수. 단 회수 가능량 < 2Gi면 아무것도 안 함

Node out of memory behavior

QoS oom_score_adj
Guaranteed -997
Burstable min(max(2, 1000 − 1000×memoryRequest/machineMemory), 999) — request 비율 클수록 낮음(=덜 죽음)
BestEffort 1000

Good practices

Schedulable resources and eviction policies

--eviction-hard=memory.available<500Mi
--system-reserved=memory=1.5Gi

DaemonSets and node-pressure eviction

Known issues

kubelet may not observe memory pressure right away

active_file memory is not considered as available memory