Allocating specific CPUs for nodes in a cluster
When using the static CPU Manager policy, you can reserve specific CPUs for use by specific nodes in your cluster. For example, on a system with 24 CPUs, you could reserve CPUs numbered 0 - 3 for the control plane allowing the compute nodes to use CPUs 4 - 23.
Reserving CPUs for nodes
To explicitly define a list of CPUs that are reserved for specific nodes, create a KubeletConfig
custom resource (CR) to define the reservedSystemCPUs
parameter. This list supersedes the CPUs that might be reserved using the systemReserved
and kubeReserved
parameters.
Procedure
Obtain the label associated with the machine config pool (MCP) for the type of node you want to configure:
$ oc describe machineconfigpool <name>
For example:
$ oc describe machineconfigpool worker
Example output
Name: worker
Namespace:
Labels: machineconfiguration.openshift.io/mco-built-in=
pools.operator.machineconfiguration.openshift.io/worker= (1)
Annotations: <none>
API Version: machineconfiguration.openshift.io/v1
Kind: MachineConfigPool
...
1 Get the MCP label. Create a YAML file for the
KubeletConfig
CR:apiVersion: machineconfiguration.openshift.io/v1
kind: KubeletConfig
metadata:
name: set-reserved-cpus (1)
spec:
kubeletConfig:
reservedSystemCPUs: "0,1,2,3" (2)
machineConfigPoolSelector:
matchLabels:
pools.operator.machineconfiguration.openshift.io/worker: "" (3)
1 Specify a name for the CR. 2 Specify the core IDs of the CPUs you want to reserve for the nodes associated with the MCP. 3 Specify the label from the MCP. Create the CR object:
$ oc create -f <file_name>.yaml
Additional resources
- For more information on the
systemReserved
andkubeReserved
parameters, see Allocating resources for nodes in an OKD cluster.