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

  1. Obtain the label associated with the machine config pool (MCP) for the type of node you want to configure:

    1. $ oc describe machineconfigpool <name>

    For example:

    1. $ oc describe machineconfigpool worker

    Example output

    1. Name: worker
    2. Namespace:
    3. Labels: machineconfiguration.openshift.io/mco-built-in=
    4. pools.operator.machineconfiguration.openshift.io/worker= (1)
    5. Annotations: <none>
    6. API Version: machineconfiguration.openshift.io/v1
    7. Kind: MachineConfigPool
    8. ...
    1Get the MCP label.
  2. Create a YAML file for the KubeletConfig CR:

    1. apiVersion: machineconfiguration.openshift.io/v1
    2. kind: KubeletConfig
    3. metadata:
    4. name: set-reserved-cpus (1)
    5. spec:
    6. kubeletConfig:
    7. reservedSystemCPUs: "0,1,2,3" (2)
    8. machineConfigPoolSelector:
    9. matchLabels:
    10. pools.operator.machineconfiguration.openshift.io/worker: "" (3)
    1Specify a name for the CR.
    2Specify the core IDs of the CPUs you want to reserve for the nodes associated with the MCP.
    3Specify the label from the MCP.
  3. Create the CR object:

    1. $ oc create -f <file_name>.yaml

Additional resources