Enable huge pages in a host profile¶
The BareMetalHostProfile
API allows configuring a host to use the
huge pages feature of the Linux kernel on managed clusters. The procedure
included in this section applies to both new and existing cluster
deployments.
Note
Huge pages is a mode of operation of the Linux kernel. With huge pages enabled, the kernel allocates the RAM in bigger chunks, or pages. This allows kernel-based virtual machines and virtual machines running on it to use the host RAM more efficiently and improves the performance of the virtual machines.
To enable huge pages in a custom bare metal host profile for a managed cluster:
Log in to the local machine where you management cluster
kubeconfig
is located and wherekubectl
is installed.Note
The management cluster
kubeconfig
is created automatically during the last stage of the management cluster bootstrap.Open for editing or create a new bare metal host profile under the
templates/bm/
directory.Edit the
grubConfig
section of the host profilespec
using the example below to configure the kernel boot parameters and enable huge pages:spec: grubConfig: defaultGrubOptions: - GRUB_DISABLE_RECOVERY="true" - GRUB_PRELOAD_MODULES=lvm - GRUB_TIMEOUT=20 - GRUB_CMDLINE_LINUX_DEFAULT="hugepagesz=1G hugepages=N"
The example configuration above will allocate
N
huge pages of 1 GB each on the server boot. The lasthugepagesz
parameter value is default unlessdefault_hugepagesz
is defined. For details about possible values, see official Linux kernel documentation.Add the bare metal host profile to your management cluster:
kubectl --kubeconfig <pathToManagementClusterKubeconfig> -n <projectName> apply -f <pathToBareMetalHostProfileFile>
If required, further modify the host profile:
kubectl --kubeconfig <pathToManagementClusterKubeconfig> -n <projectName> edit baremetalhostprofile <hostProfileName>
Proceed to Create a MOSK cluster.