When starting a postgres DB container via kubernetes on linux host server, it failed to start the container.
1 | [root@compute2 log]# kubectl get pod |
1 | [root@compute2 log]# kubectl logs test-764dc8f84b-smg92 |
Image is with no problem cuz I can do docker run
to start container successfully.
————————————— Solution —————————————
https://github.com/docker-library/postgres/issues/451
there are several possible solutions to the problem:
- Modify the docker image to be able to set huge_pages = off in /usr/share/postgresql/postgresql.conf.sample before initdb was ran (this is what I did).
- Turn off huge page support on the system (vm.nr_hugepages = 0 in /etc/sysctl.conf).
- Fix Postgres’s fallback mechanism when huge_pages = try is set (the default).
- Modify the k8s manifest to enable huge page support (https://kubernetes.io/docs/tasks/manage-hugepages/scheduling-hugepages/).
- Modify k8s to show that huge pages are not supported on the system, when they are not enabled for a specific container.
I tried the second way, and solve the issue successfully.