12.4. 配置单个 NUMA 节点策略


NUMA Resources Operator 要求在集群中配置单个 NUMA 节点策略。这可以通过创建并应用性能配置集或配置 KubeletConfig 来实现。

注意

配置单个 NUMA 节点策略的首选方法是应用性能配置集。您可以使用 Performance Profile Creator (PPC) 工具来创建性能配置集。如果在集群中创建了性能配置集,它会自动创建 KubeletConfigtuned 配置集等其他调优组件。

有关创建性能配置集的更多信息,请参阅"添加资源"部分中的"关于 Performance Profile Creator"。

12.4.1. 性能配置集示例

此 YAML 示例显示使用性能配置集创建器(PPC) 工具创建的性能配置集:

apiVersion: performance.openshift.io/v2
kind: PerformanceProfile
metadata:
  name: performance
spec:
  cpu:
    isolated: "3"
    reserved: 0-2
  machineConfigPoolSelector:
    pools.operator.machineconfiguration.openshift.io/worker: "" 
1

  nodeSelector:
    node-role.kubernetes.io/worker: ""
  numa:
    topologyPolicy: single-numa-node 
2

  realTimeKernel:
    enabled: true
  workloadHints:
    highPowerConsumption: true
    perPodPowerManagement: false
    realTime: true
Copy to Clipboard Toggle word wrap
1
这个值必须与您要配置 NUMA Resources Operator 的 MachineConfigPool 值匹配。例如,您可以创建一个名为 worker-cnfMachineConfigPool 对象,该对象指定运行电信工作负载的一组节点。MachineConfigPool 的值必须与稍后在"Creating NUMAResourcesOperator 自定义资源"中配置的 NUMAResourcesOperator CR 中的 machineConfigPoolSelector 值匹配。
2
在运行 PPC 工具时,将 topology-manager-policy 参数设置为 single-numa-node,以确保 topologyPolicy 字段设置为 single-numa-node
注意

对于托管的 control plane 集群,MachineConfigPoolSelector 没有任何功能效果。节点关联由指定的 NodePool 对象决定。

12.4.2. 创建 KubeletConfig CR

配置单个 NUMA 节点策略的建议方法是应用性能配置集。另一种方法是创建并应用 KubeletConfig 自定义资源 (CR),如下所示。

流程

  1. 创建 KubeletConfig 自定义资源 (CR) 来为机器配置集配置 pod admittance 策略:

    1. 将以下 YAML 保存到 nro-kubeletconfig.yaml 文件中:

      apiVersion: machineconfiguration.openshift.io/v1
      kind: KubeletConfig
      metadata:
        name: worker-tuning
      spec:
        machineConfigPoolSelector:
          matchLabels:
            pools.operator.machineconfiguration.openshift.io/worker: "" 
      1
      
        kubeletConfig:
          cpuManagerPolicy: "static" 
      2
      
          cpuManagerReconcilePeriod: "5s"
          reservedSystemCPUs: "0,1" 
      3
      
          memoryManagerPolicy: "Static" 
      4
      
          evictionHard:
            memory.available: "100Mi"
          kubeReserved:
            memory: "512Mi"
          reservedMemory:
            - numaNode: 0
              limits:
                memory: "1124Mi"
          systemReserved:
            memory: "512Mi"
          topologyManagerPolicy: "single-numa-node" 
      5
      Copy to Clipboard Toggle word wrap
      1
      确保此标签与稍后在"创建 NUMAResourcesOperator 自定义资源"中配置的 NUMAResourcesOperator CR 中的 machineConfigPoolSelector 设置匹配。
      2
      对于 cpuManagerPolicystatic 必须使用小写 s
      3
      根据您的节点上的 CPU 进行调整。
      4
      对于 memoryManagerPolicyStatic 必须使用大写 S
      5
      topologyManagerPolicy 必须设置为 single-numa-node
      注意

      对于托管的 control plane 集群,MachineConfigPoolSelector 设置没有任何功能效果。节点关联由指定的 NodePool 对象决定。要为托管的 control plane 集群应用 KubeletConfig,您必须创建一个包含配置的 ConfigMap,然后在 NodePoolspec.config 字段中引用该 ConfigMap

    2. 运行以下命令来创建 KubeletConfig CR:

      $ oc create -f nro-kubeletconfig.yaml
      Copy to Clipboard Toggle word wrap
      注意

      应用性能配置集或 KubeletConfig 会自动触发节点重新引导。如果没有触发重启,您可以通过查看处理节点组的 KubeletConfig 中的标签来排除此问题。

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat