Setting up dedicated nodes for your Db2 deployment

You can dedicate one or more worker nodes to your Db2 database service. The nodes are then used exclusively by the database containers or pods.

About this task

Red Hat® OpenShift® uses the concepts of taint and toleration to dedicate a service such as Db2 to particular nodes. Nodes are tainted and labeled:

  • A taint prevents pods from being deployed on a tainted node.
  • A label allows for a pod with a matching toleration to be treated as an exception.

Taint and toleration work together to provide node exclusivity to deploying Db2 on particular nodes

Perform these steps for each worker node that you plan to dedicate to the database deployment. The steps use Red Hat OpenShift CLI commands. The node_name is the name of a worker node on which you plan to host Db2.

Procedure

  1. Retrieve the name of the worker node that you want to dedicate to Db2:
    oc get nodes
  2. Edit the configmap to add the toleration for the custom taint:
    oc edit configmap rook-ceph-operator-config -n openshift-storage
  3. Check the configmap to verify that the toleration has been added:
    oc get configmap rook-ceph-operator-config -n openshift-storage -o yaml
    Refer to the following example:
    apiVersion: v1
    data:
    [...]
      CSI_PLUGIN_TOLERATIONS: |
        - key: nodetype
          operator: Equal
          value: infra
          effect: NoSchedule
        - key: node.ocs.openshift.io/storage
          operator: Equal
          value: "true"
          effect: NoSchedule
    [...]
    kind: ConfigMap
    metadata:
    [...]
    Remember: Ensure that all non-string values in the Tolerations value field have quotation marks. For example, the values true which is of type boolean, and 1 which is of type int must be input as "true" and "1".
  4. Restart the rook-ceph-operator if the csi-cephfsplugin-* and csi-rbdplugin-* pods fail to come up on their own on the infra nodes.
    oc delete -n openshift-storage pod <name of the rook_ceph_operator pod>
    Refer to the following example output:
    oc delete -n openshift-storage pod rook-ceph-operator-5446f9b95b-jrn2j
    pod "rook-ceph-operator-5446f9b95b-jrn2j" deleted
  5. Taint the node with the NoSchedule effect and safely evict all of the pods from that node:
    oc adm taint node node_name icp4data=dedicated_specifier:NoSchedule --overwrite
    oc adm drain node_name
    oc adm uncordon node_name
    Where dedicated_specifier is an identifier that is used to deploy a database only on nodes that have the dedicated_specifier label. By default, the dedicated_specifier for Db2 is database-db2oltp. The --overwrite flag is only required if the node is already tainted or labeled and ensures that the taint or label is replaced.
    Important: In the case of an error after running the oc adm drain command, the administrator must review the error message and execute the command with the specified options.
  6. Verify that the csi-cephfsplugin-* and csi-rbdplugin-* pods are running on the Tainted nodes.
    oc get pods -A --field-selector spec.nodeName=<Tainted Node>
  7. Label the node:
    oc label node node_name icp4data=dedicated_specifier --overwrite
    Note: When you create a database deployment, you will provide the dedicated_specifier label that you used in the Value for node label field.
  8. Optional: Verify that the node is labeled:
    oc get node --show-labels

What to do next

Configure storage for your Db2 instance. See Configuring database storage for Db2 for more details.