docker-library/docs

Document issues with postgresql, K8s, and transparent huge pages

jdevries3133 opened this issue · 1 comments

PostgreSQL, K8s, and transparent huge pages do not play nice together; there are several open issues discussing the exact details here;

docker-library/postgres#946

docker-library/postgres#451 (comment)

It took me a very long time to figure out the workarounds that I've documented (mostly for my own sake) in https://github.com/jdevries3133/homelab_cluster/tree/main/postgres_hello_world.

I realize there are some docs about how to configure PostgreSQL in general (https://github.com/docker-library/docs/tree/master/postgres#database-configuration). I think it would be good to add a sub-section about this problem. As I understand it (and I think I may be wrong, to some extent), the problem is:

  • containerd (and maybe other container runtimes) are unable to provide hugepages to containers
  • nonetheless, PostgreSQL is configured to "try" to use transparent hugepages
  • although transparent hugepages cannot really be provided, in this context, postgres somehow internally comes to believe that it has access to transparent hugepages
  • ???
  • segmentation fault

And, therefore, the solution I have come to is (maybe) to disable transparent hugepages on the underlying K8s nodes and to also to disable transparent hugepages in PostgreSQL configuration.

To conclude: I have some ubuntu server nodes. I do some kubeadm cluseter. I try to use PostgreSQL. PostgreSQL no work. Seems like this is a typical enough pattern we should try to make it stink less if possible!