Jeremy Schneider explains that Kubernetes relies on cgroups v2 memory.stat (current-inactive_file) to calculate container_memory_working_set_bytes for pod eviction. For PostgreSQL, this metric is misleading because it reflects file cache rather than actual resident memory usage, failing to predict Out-Of-Memory crashes. The author recommends abandoning this metric for Postgres workloads in favor of more accurate indicators of memory pressure.
- K8s eviction logic uses container_memory_working_set_bytes, which is inaccurate for Postgres memory reporting.
- The metric tracks inactive file cache, not resident memory, hiding true OOM risk from DBAs.
- Setting requests < limits with this metric can lead to unexpected pod kills for database workloads.
- Use alternative metrics provided in the author's analysis to monitor actual Postgres memory pressure.