This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.13.4. 配置巨页
节点必须预先分配在 OpenShift Container Platform 集群中使用的巨页。保留巨页的方法有两种: 在引导时和在运行时。在引导时进行保留会增加成功的可能性,因为内存还没有很大的碎片。Node Tuning Operator 目前支持在特定节点上分配巨页。
13.4.1. 在引导时
流程
要减少节点重启的情况,请按照以下步骤顺序进行操作:
通过标签标记所有需要相同巨页设置的节点。
oc label node <node_using_hugepages> node-role.kubernetes.io/worker-hp=
$ oc label node <node_using_hugepages> node-role.kubernetes.io/worker-hp=
Copy to Clipboard Copied! 创建一个包含以下内容的文件,并把它命名为
hugepages_tuning.yaml
:apiVersion: tuned.openshift.io/v1 kind: Tuned metadata: name: hugepages namespace: openshift-cluster-node-tuning-operator spec: profile: - data: | [main] summary=Boot time configuration for hugepages include=openshift-node [bootloader] cmdline_openshift_node_hugepages=hugepagesz=2M hugepages=50 name: openshift-node-hugepages recommend: - machineConfigLabels: machineconfiguration.openshift.io/role: "worker-hp" priority: 30 profile: openshift-node-hugepages
apiVersion: tuned.openshift.io/v1 kind: Tuned metadata: name: hugepages
1 namespace: openshift-cluster-node-tuning-operator spec: profile:
2 - data: | [main] summary=Boot time configuration for hugepages include=openshift-node [bootloader] cmdline_openshift_node_hugepages=hugepagesz=2M hugepages=50
3 name: openshift-node-hugepages recommend: - machineConfigLabels:
4 machineconfiguration.openshift.io/role: "worker-hp" priority: 30 profile: openshift-node-hugepages
Copy to Clipboard Copied! 创建 Tuned
hugepages
对象oc create -f hugepages-tuned-boottime.yaml
$ oc create -f hugepages-tuned-boottime.yaml
Copy to Clipboard Copied! 创建一个带有以下内容的文件,并把它命名为
hugepages-mcp.yaml
:apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfigPool metadata: name: worker-hp labels: worker-hp: "" spec: machineConfigSelector: matchExpressions: - {key: machineconfiguration.openshift.io/role, operator: In, values: [worker,worker-hp]} nodeSelector: matchLabels: node-role.kubernetes.io/worker-hp: ""
apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfigPool metadata: name: worker-hp labels: worker-hp: "" spec: machineConfigSelector: matchExpressions: - {key: machineconfiguration.openshift.io/role, operator: In, values: [worker,worker-hp]} nodeSelector: matchLabels: node-role.kubernetes.io/worker-hp: ""
Copy to Clipboard Copied! 创建机器配置池:
oc create -f hugepages-mcp.yaml
$ oc create -f hugepages-mcp.yaml
Copy to Clipboard Copied!
因为有足够的非碎片内存,worker-hp
机器配置池中的所有节点现在都应分配 50 个 2Mi 巨页。
oc get node <node_using_hugepages> -o jsonpath="{.status.allocatable.hugepages-2Mi}"
$ oc get node <node_using_hugepages> -o jsonpath="{.status.allocatable.hugepages-2Mi}"
100Mi
目前,这个功能只在 Red Hat Enterprise Linux CoreOS(RHCOS)8.x worker 节点上被支持。在 Red Hat Enterprise Linux (RHEL) 7.x worker 节点上,目前不支持 TuneD [bootloader]
插件。