Kubernetes (K8s) (50 Qs)•Part 3: Advanced Internals, Scale & Production Security (Senior / Lead)
Handling Ephemeral Storage Evictions.
senior LevelMost AskedCode ExampleSecurity & Auth
In Simple Words:
Pods write logs, build artifacts, and scratch data to /var/lib/kubelet/pods/<id> on the host disk:
- If a pod writes a runaway 20GB log file without constraints, the host node disk hits 85% utilization, triggering
DiskPressure. - Kubelet begins evicting Pods randomly!
- Solution: Always define
ephemeral-storagerequests and limits:yamlresources: requests: ephemeral-storage: "2Gi" limits: ephemeral-storage: "5Gi" # Container killed if it writes >5GB to rootfs/emptyDir!