Creating an MPAM Resource Group
To limit resources for a Pod, you need to create an MPAM resource group.
- Go to the samples directory and modify the configuration file (in .yaml format) of the MPAM resource group. The following uses example-config.yaml as an example.
In the example-config.yaml file, a node resource group may have any of the three configurations, as described in Table 1. You can use ConfigMaps to create a configuration for a node or a group of nodes. After the configuration is created, the MPAM plugin manages the ConfigMaps in the Kubernetes cluster and automatically applies the configuration to the corresponding nodes after a ConfigMap is added or updated.
Table 1 Configuration types Configuration Type
Configuration Name
Description
Node configuration
rc-config.node.{NODE_NAME}
Provides the configuration of the node named Node_NAME.
Node group configuration
rc-config.group.{GROUP_NAME}
You can use the ngroup label to add a node to a node group. For example, if a node contains the ngroup=grp1 label, the node belongs to the node group grp1. If the ConfigMap rc-config.node.{NODE_NAME} for a node does not exist but the node belongs to the GROUP_NAME node group, the ConfigMap named rc-config.group.{GROUP_NAME} is applied to this node.
Default configuration
rc-config.default
If a node does not belong to any node group and the corresponding ConfigMap does not exist, the ConfigMap named rc-config.default is applied to this node.
- Open the file.
cd samples vi example-config.yaml
- Press i to enter the insert mode. Set the name field to the actual configuration name in Table 1 and add the resource group information to the mpam field.
apiVersion: v1 kind: ConfigMap metadata: name: ${CONFIG_NAME} namespace: rc-config data: rc.conf: | mpam: group1: llc: <schemata> mb: <schemata> group2: llc: <schemata> mb: <schemata> group3: llc: <schemata> mb: <schemata>
- Replace the schemata following llc with the restriction on the L3 cache and the schemata following mb with the bandwidth restriction. Set the values based on your requirements. For details about the complete configuration of the example-config.yaml file, see References.
- A maximum of 32 resource groups can be configured. (The root group occupies one resource group by default, and a maximum of 31 new resource groups can be created under the root group.) Each schemata must comply with the syntax rules.
- If an item is not configured in a resource group or a configuration item does not meet the syntax rules, the resource group uses the default configuration of the configuration item. The default L3 cache configuration is "L3:0=fffffff;1=fffffff;2=fffffff;3=fffffff" and the default bandwidth configuration is "MB:0=100;1=100;2=100;3=100". If mbHdl is selected for mounting, the default Hard Limit configuration is "MBHDL:0=1;1=1;2=1;3=1".
- Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
- Open the file.
- In the samples directory, use the example-config.yaml file to create a ConfigMap.
kubectl apply -f example-config.yaml
- On the node, go to the /sys/fs/resctrl directory and check whether a resource group has been created and whether the resource group configuration matches the example-config.yaml file.
cd /sys/fs/resctrl ls
For example, you can run the following command to view the configuration of the resource group group1:
cat group1/schemata