Install IBM DB2 relational database on Openshift

DB2 installation guide on Openshift for demo and lab environment


Author(s): Tamas Bures | Created: 15 July 2020 | Last modified: 15 July 2020
Tested on: Red Hat OpenShift Platform v 4.3.24 & IBM DB2 11.5.4

Install IBM DB2 relational database on Openshift

In this guide, I will demonstrate how to install IBM DB2 11.5.4 on Red Hat OpenShift Container Platform 4.3.24 (OCP) .

  1. Download the ibm-db2 charts from Github

  2. Initialize oc command line interface by logging into your cluster:

     oc login -u kubeadmin -n default
  3. Initialize helm command line interface as well:

     helm init --client-only --skip-refresh --tls
  4. Create a new namespace:

     oc new-project db2
  5. Obtain an API token for IBM Container Registry

  6. Configure shell variables, makes easier the following commands:

     export PROJECT=db2
     export APIKEY=<obtained API key>
     export RELEASE_NAME=db2ocp
    
     # Will be used for DB2 instance user and ldap user password
     export PASSWORD=password
    
     # MUST BE BLOCK TYPE storage class
     export SC_CLASS=ocs-storagecluster-cephfs
  7. Execute DB2 installation prerequisites

     pre-install/clusterAdministration/createSecurityClusterPrereqs.sh
     pre-install/namespaceAdministration/createSecurityNamespacePrereqs.sh ${PROJECT}
  8. Create registry access secrets:

     oc create secret docker-registry ibm-registry --docker-server=icr.io --docker-username=iamapikey --docker-password=${APIKEY}
     oc secrets link db2u ibm-registry --for=pull
  9. Create DB2 secrets:

     oc create secret generic ${RELEASE_NAME}-db2u-ldap-bluadmin --from-literal=password="${PASSWORD}"
     oc create secret generic ${RELEASE_NAME}-db2u-instance --from-literal=password="${PASSWORD}"
  10. Edit the helm_options file:

    • update/add: global.nodeLabel.value=db2node
    • update/add: hadr.enabled="false"
    • update/add: rest.enabled="true"
  11. Add the following label to the nodes where to you want to install db2 services icp4data=<value set in helm_options file at option 'global.nodeLabel.value'>

  12. Start installation:

     cd common
     ./db2u-install --db-type db2oltp --namespace ${PROJECT} --release-name ${RELEASE_NAME} --storage-class ${SC_CLASS} --tls --helm-opt-file helm_options --accept-eula