Configure kubelet parameters and values in MicroShift
To enable low latency on a MicroShift node, add the required settings to the MicroShift config.yaml file.
-
You installed the OpenShift CLI (
oc). -
You have root access to the node.
-
You made a copy of the provided
config.yaml.defaultfile in the/etc/microshift/directory, and renamed itconfig.yaml.
-
Add the kubelet configuration to the MicroShift
config.yamlfile:Example passthroughkubeletconfigurationapiServer: # ... kubelet: cpuManagerPolicy: static cpuManagerPolicyOptions: full-pcpus-only: "true" cpuManagerReconcilePeriod: 5s memoryManagerPolicy: Static topologyManagerPolicy: single-numa-node reservedSystemCPUs: 0-1 reservedMemory: - limits: memory: 1100Mi numaNode: 0 kubeReserved: memory: 500Mi systemReserved: memory: 500Mi evictionHard: imagefs.available: "15%" memory.available: "100Mi" nodefs.available: "10%" nodefs.inodesFree: "5%" evictionPressureTransitionPeriod: 5m # ...kubelet-
If you change the CPU or memory managers in the kubelet configuration, you must remove files that cache the previous configuration. Restart the host to remove them automatically, or manually remove the
/var/lib/kubelet/cpu_manager_stateand/var/lib/kubelet/memory_manager_statefiles. kubelet.cpuManagerPolicy-
The name of the policy to use. Valid values are
noneandstatic. Requires theCPUManagerfeature gate to be enabled. Default value isnone. kubelet.cpuManagerPolicyOptions.full-pcpus-only-
A set of
key=valuepairs for setting extra options that fine tune the behavior of theCPUManagerpolicies. The default value isnull. Requires both theCPUManagerandCPUManagerPolicyOptionsfeature gates to be enabled. kubelet.memoryManagerPolicy-
The name of the policy used by Memory Manager. Case-sensitive. The default value is
none. Requires theMemoryManagerfeature gate to be enabled. kubelet.reservedSystemCPUs-
Required. The
reservedSystemCPUsvalue must be the inverse of the offlined CPUs because both values combined must account for all of the CPUs on the system. This parameter is essential to dividing the management and application workloads. Use this parameter to define a static CPU set for the host-level system and Kubernetes daemons, plus interrupts and timers. Then the rest of the CPUs on the system can be used exclusively for workloads. kubelet.reservedMemory[0].limits.memory-
The value in
reservedMemory[0].limits.memory,1100Mi in this example, is equal tokubeReserved.memory+systemReserved.memory+evictionHard.memory.available. kubelet.evictionHard-
The
evictionHardparameters define under which conditions the kubelet evicts pods. When you change the default value of only one parameter for theevictionHardstanza, the default values of other parameters are not inherited and are set to zero. Provide all the threshold values even when you want to change just one. kubelet.evictionHard.imagefs.available-
The
imagefsis a filesystem that container runtimes use to store container images and container writable layers. In this example, theevictionHard.imagefs.availableparameter means that the pod is evicted when the available space of the image filesystem is less than 15%. kubelet.evictionHard.memory.available-
In this example, the
evictionHard.memory.availableparameter means that the pods are evicted when the available memory of the node drops below 100MiB. kubelet.evictionHard.nodefs.available-
In this example, the
evictionHard.nodefs.availableparameter means that the pods are evicted when the main filesystem of the node has less than 10% available space. kubelet.evictionHard.nodefs.inodesFree-
In this example, the
evictionHard.nodefs.inodesFreeparameter means that the pods are evicted when more than 15% of the node’s main filesystem’s inodes are in use. kubelet.evictionPressureTransitionPeriod-
For container garbage collection: The duration to wait before transitioning out of an eviction pressure condition. Setting the
evictionPressureTransitionPeriodparameter to0configures the default value of 5 minutes.
-
After you complete the next steps and restart the host, you can use a root-access account to check that your settings are in the
config.yamlfile in the/var/lib/microshift/resources/kubelet/config/directory.
-
Enable workload partitioning.
-
Tune your operating system. For example, configure and activate a TuneD profile.
-
Optional: Configure automatic enablement of your TuneD profile.
-
Optional: If you are using the x86_64 architecture, you can install Red Hat Enterprise Linux for Real Time (real-time kernel).
-
Prepare your MicroShift workloads for low latency.