Label a cluster node and apply a TuneD configuration to it, without affecting other cluster nodes.
Outcomes
Use the Node Tuning Operator to create a TuneD profile that configures a compute node setting for optimizing a database workload.
As the student user on the workstation machine, use the lab command to prepare your environment for this exercise, and to ensure that all required resources are available.
[student@workstation ~]$ lab start nodes-operators
Instructions
The software vendor for the database that is used in a company application recommends adjusting a specific setting to improve performance.
The suggestion is to disable the transparent_hugepages setting, which is enabled by default, on the compute node where the database runs, to improve memory management.
Your company requests that you configure an RHOCP cluster node for the database that requires this memory management adjustment.
Create a TuneD profile through the Node Tuning Operator, which configures the worker01 node to run the database with the customization for the node memory management, which the software vendor recommends.
Verify the initial setting and updated value on the node by inspecting the value in the /sys/kernel/mm/transparent_hugepage/enabled file.
Connect to the OpenShift cluster and verify the roles for the nodes in the cluster.
Connect to the OpenShift cluster as the admin user with redhatocp as the password.
[student@workstation ~]$ oc login -u admin -p redhatocp \
https://api.ocp4.example.com:6443
Login successful.
...output omitted...Verify that the worker01 node has the stabledb label.
[student@workstation ~]$oc get nodesNAME STATUS ROLES AGE VERSION master01 Ready control-plane,master 47d v1.25.7+eab9cc9 master02 Ready control-plane,master 47d v1.25.7+eab9cc9 master03 Ready control-plane,master 47d v1.25.7+eab9cc9 worker01 Readystabledb,worker 16h v1.25.7+eab9cc9 worker02 Ready worker 16h v1.25.7+eab9cc9 worker03 Ready worker 16h v1.25.7+eab9cc9
View the pods that are running in the openshift-cluster-node-tuning-operator namespace.
View the existing TuneD profiles and configuration for the cluster.
View the running pods in the namespace.
[student@workstation ~]$ oc get pods -n \
openshift-cluster-node-tuning-operator
NAME READY STATUS RESTARTS AGE
cluster-node-tuning-operator-... 1/1 Running 2 47d
tuned-45hlf 1/1 Running 1 18h
tuned-glr54 1/1 Running 1 18h
...output omitted...View the current tuned profiles in use for each cluster node.
[student@workstation ~]$ oc get profile -n openshift-cluster-node-tuning-operator
NAME TUNED APPLIED DEGRADED AGE
master01 openshift-control-plane True False 47d
master02 openshift-control-plane True False 47d
master03 openshift-control-plane True False 47d
worker01 openshift-node True False 20h
worker02 openshift-node True False 20h
worker03 openshift-node True False 20hView the TuneD configuration in the cluster.
[student@workstation ~]$oc get tuneds.tuned.openshift.io \ -n openshift-cluster-node-tuning-operator -o yamlapiVersion: v1 items: - apiVersion: tuned.openshift.io/v1kind: Tunedmetadata: creationTimestamp: "2023-10-04T10:12:26Z" generation: 1 name: default namespace: openshift-cluster-node-tuning-operator resourceVersion: "8714" uid: a4b818f2-dab5-4091-9beb-c763d216a75a spec: profile: -data: | [main] summary=Optimize systems running OpenShift (provider specific parent profile) include=-provider-${f:exec:cat:/var/lib/tuned/provider},openshiftname: openshift recommend: -match: - label: node-role.kubernetes.io/master - label: node-role.kubernetes.io/infraoperand: tunedConfig: {}priority: 30...output omitted...
Create a debug pod to connect to the worker01 node and inspect the current setting for the transparent_hugepages setting.
Open a new terminal window and create a debug pod to connect to the worker01 node.
[student@workstation ~]$ oc debug node/worker01
...output omitted...
sh-4.4#View the current transparent_hugepages setting by displaying the value in the setting enabled file.
The [always] indicator denotes that the setting is always enabled.
sh-4.4# cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvise neverLog out and remove the debug pod for the worker01 node.
sh-4.4# exit
...output omitted...Navigate to the exercise directory and create a TuneD profile CR file named stabledbCR.yml that defines a TuneD profile stabledb-tuning to disable the transparent_hugepage setting for nodes with the stabledb label.
You can find an incomplete example for the CR in the ~/DO380/labs/nodes-operators/stabledbCR.yml file.
Change to the working directory for the exercise.
[student@workstation ~]$ cd ~/DO380/labs/nodes-operatorsCreate the stabledbCR.yml file and define the resource kind as Tuned for the metadata name of stabledb-tuning.
apiVersion: tuned.openshift.io/v1 kind:Tunedmetadata: name:stabledb-tuningnamespace: openshift-cluster-node-tuning-operator
Specify the profile name as stabledb-tuning.
You can add an optional description in the summary key for the profile.
spec: profile: - name:stabledb-tuningdata: | [main] summary=Worker optimization disabling transparent_hugepages.
Supply the arguments for the customization that disables the transparent_hugepages value.
[vm]
transparent_hugepage=neverAdd the recommend section to the CR to target the node with the stabledb label.
recommend:
- match:
- label: node-role.kubernetes.io/stabledbFinally, provide the priority that is equal to or less than the currently applied profile. Profiles with lower priority values take precedence over ones with a higher value.
priority: 30Verify that the file resembles the following CR:
apiVersion: tuned.openshift.io/v1 kind: Tuned metadata: name:stabledb-tuningnamespace: openshift-cluster-node-tuning-operator spec: profile: - name:stabledb-tuningdata: | [main] summary=Worker optimization disabling transparent_hugepages. [vm] transparent_hugepage=neverrecommend: - match: - label: node-role.kubernetes.io/stabledb priority: 30 profile:stabledb-tuning
Apply the TuneD CR and verify that the profile is applied to the worker01 node.
Apply the TuneD CR.
[student@workstation nodes-operators]$ oc apply -f stabledbCR.yml
tuned.tuned.openshift.io/stabledb-tuning createdVerify the stabled-tuning profile for the worker01 node.
[student@workstation nodes-operators]$oc get profile \ -n openshift-cluster-node-tuning-operatorNAME TUNED APPLIED DEGRADED AGE master01 openshift-control-plane True False 47d master02 openshift-control-plane True False 47d master03 openshift-control-plane True False 47d worker01stabledb-tuningTrue False 20h worker02 openshift-node True False 20h worker03 openshift-node True False 20h
From the second terminal window, re-create the debug pod to connect to the worker01 node and verify the updated transparent_hugepages setting.
This setting should reflect the changes from the new TuneD profile and no longer be enabled.
Open a new terminal window and create a debug pod to connect to the worker01 node.
[student@workstation nodes-operators]$ oc debug node/worker01
...output omitted...
sh-4.4#View the current setting for transparent_hugepages by displaying the value in the setting enabled file.
The [never] value denotes that the setting is disabled.
sh-4.4# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]Log out and remove the debug pod for the worker01 node.
sh-4.4# exit
...output omitted...Change to the /home/student directory.
[student@workstation nodes-review]$ cd