Bookmark this page

Guided Exercise: Node Configuration with Special Purpose Operators

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.

  1. Connect to the OpenShift cluster and verify the roles for the nodes in the cluster.

    1. 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...
  2. Verify that the worker01 node has the stabledb label.

    [student@workstation ~]$ oc get nodes
    NAME       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   Ready    stabledb,worker        16h   v1.25.7+eab9cc9
    worker02   Ready    worker                 16h   v1.25.7+eab9cc9
    worker03   Ready    worker                 16h   v1.25.7+eab9cc9
  3. View the pods that are running in the openshift-cluster-node-tuning-operator namespace. View the existing TuneD profiles and configuration for the cluster.

    1. 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...
    2. 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    20h
    3. View the TuneD configuration in the cluster.

      [student@workstation ~]$ oc get tuneds.tuned.openshift.io \
        -n openshift-cluster-node-tuning-operator -o yaml
      apiVersion: v1
      items:
      - apiVersion: tuned.openshift.io/v1
        kind: Tuned
        metadata:
          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},openshift
            name: openshift
          recommend:
          - match:
            - label: node-role.kubernetes.io/master
            - label: node-role.kubernetes.io/infra
            operand:
              tunedConfig: {}
            priority: 30
      ...output omitted...
  4. Create a debug pod to connect to the worker01 node and inspect the current setting for the transparent_hugepages setting.

    1. 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#
    2. 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 never
    3. Log out and remove the debug pod for the worker01 node.

      sh-4.4# exit
      ...output omitted...
  5. 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.

    1. Change to the working directory for the exercise.

      [student@workstation ~]$ cd ~/DO380/labs/nodes-operators
    2. Create the stabledbCR.yml file and define the resource kind as Tuned for the metadata name of stabledb-tuning.

      apiVersion: tuned.openshift.io/v1
      kind: Tuned
      metadata:
        name: stabledb-tuning
        namespace: openshift-cluster-node-tuning-operator
    3. Specify the profile name as stabledb-tuning. You can add an optional description in the summary key for the profile.

      spec:
        profile:
        - name: stabledb-tuning
          data: |
            [main]
            summary=Worker optimization disabling transparent_hugepages.
    4. Supply the arguments for the customization that disables the transparent_hugepages value.

      [vm]
      transparent_hugepage=never
    5. Add the recommend section to the CR to target the node with the stabledb label.

      recommend:
      - match:
        - label: node-role.kubernetes.io/stabledb
    6. Finally, 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: 30
    7. Verify that the file resembles the following CR:

      apiVersion: tuned.openshift.io/v1
      kind: Tuned
      metadata:
        name: stabledb-tuning
        namespace: openshift-cluster-node-tuning-operator
      spec:
        profile:
        - name: stabledb-tuning
          data: |
            [main]
            summary=Worker optimization disabling transparent_hugepages.
            [vm]
            transparent_hugepage=never
      
        recommend:
        - match:
          - label: node-role.kubernetes.io/stabledb
          priority: 30
          profile: stabledb-tuning
  6. Apply the TuneD CR and verify that the profile is applied to the worker01 node.

    1. Apply the TuneD CR.

      [student@workstation nodes-operators]$ oc apply -f stabledbCR.yml
      tuned.tuned.openshift.io/stabledb-tuning created
    2. Verify the stabled-tuning profile for the worker01 node.

      [student@workstation nodes-operators]$ 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  stabledb-tuning          True    False    20h
      worker02  openshift-node           True    False    20h
      worker03  openshift-node           True    False    20h
  7. 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.

    1. 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#
    2. 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]
    3. Log out and remove the debug pod for the worker01 node.

      sh-4.4# exit
      ...output omitted...
  8. Change to the /home/student directory.

    [student@workstation nodes-review]$ cd

Finish

On the workstation machine, use the lab command to complete this exercise. This step is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab finish nodes-operators

Revision: do380-4.14-397a507