Jeremy Schneider provides an alternative:
Kubernetes metric
container_memory_working_set_bytesis used for evicting/killing pods with too much memory use, especially ifmemory request < limit(don’t do this with Postgres). The metric is calculated from cgroups v2memory.statascurrent-inactive_file[source].You’d assume it’s a good metric for memory usage in kubernetes. But with Postgres, this metric is very inaccurate for memory utilization and doesn’t tell you at all if you’re going to OOM crash your database.
Click through to understand what goes wrong, why it does, and what you can use instead.