Let us assume, we need 1GiB of 2MiB-sized huge pages
. This will require a minimum number of 512 such pages (i.e. 1GiB total) on each node.
To view the number of available pages on each node, execute:
grep HugePages /proc/meminfo
Sample Output:
AnonHugePages: 0 kB
ShmemHugePages: 0 kB
HugePages_Total: 1024
HugePages_Free: 671
HugePages_Rsvd: 0
HugePages_Surp: 0
If the number of available pages is less than 512, then the page count should be reconfigured as required, accounting for any other workloads which may be co-resident on the worker node and which also require them. For example:
echo 512 | sudo tee /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
Ensure that the above changes are made persistent across reboots. This can be done by adding the required value to
/etc/sysctl.conf
echo vm.nr_hugepages = 512 | sudo tee -a /etc/sysctl.conf
Next, to apply the Huge Page configuration changes of the node, you must either restart kubelet or reboot the node.