Data and AI on Power

 View Only

How to scale a Db2 pod in Red Hat OpenShift Container Platform and IBM Cloud Pak for Data

By Shadman Kaif posted Thu December 07, 2023 11:27 AM


The purpose of a Db2 pod in OpenShift Container Platform (OCP) is to provide a scalable and containerized environment for running IBM Db2 databases. In terms of requirements for a Db2 pod, the number of vCPUs and memory are influenced by factors such as the complexity of queries, the volume of data being processed, and the number of concurrent users.

When considering an integration with IBM Cloud Pak for Data (CP4D), the Db2 pod's resource allocation becomes crucial for optimal performance in conjunction with the advanced analytics, machine learning, and data governance features offered by CP4D. In this blog, you'll learn to effectively deploy and manage Db2 pods within an OpenShift Container Platform cluster, taking into account the specific requirements imposed by integrating with IBM Cloud Pak for Data.

Required permissions

You must be either:

  • A cluster administrator, or
  • An administrator of the project where the software is installed, for example cpd-instance

When to scale the Db2 pod

You can scale the Db2 pod at any time after you install it.

Estimated time to complete

Assuming you have the required permissions, scaling the Db2 pod and waiting for it to restart should take less than 5 minutes.

How to scale the Db2 pod

  1. Log into the OCP cluster

  2. Verify the Db2 pod using oc get pod | grep db2. You should have two pods for db2oltp: db2u and etcd. An example of the expected output is shown below:

    [root@sphrapids2lp1 setup]# oc get pod | grep db2 c-db2oltp-20231117-db2u-0 1/1 Running 0 29h c-db2oltp-20231117-etcd-0 1/1 Running 0 29h [root@sphrapids2lp1 setup]# oc edit StatefulSet/c-db2oltp-20231117-db2u statefulset.apps/c-db2oltp-20231117-db2u edited

  3. Verify that the db2u pod is in StatefulSet by using oc describe pod <name of your db2u pod> | grep Stateful. An example is:

    [root@sphrapids2lp1 setup]# oc describe pod c-db2oltp-20231117-db2u-0 | grep Stateful Controlled By: StatefulSet/c-db2oltp-20231117-db2u

  4. Edit the db2u pod using oc edit StatefulSet/c-db2oltp-20231117-db2u. When editing the db2u's Statefulset, find the resources section and change the pod’s limits and requests specifications to your desired memory and vCPU and save. Ensure that the limits and requests are the same. An example of changing the memory to 48 GB and vCPU to 10 is shown below:

    resources: limits: cpu: "10" ephemeral-storage: 4Gi memory: 48Gi requests: cpu: "10" ephemeral-storage: 4Gi memory: 48Gi

  5. Force the restart of the db2 pods using oc delete pod <name of your db2u pod> <name of your etcd pod> and then simply wait for the pods to be in running state again.

    [root@sphrapids2lp1 setup]# oc delete pod c-db2oltp-20231117-db2u-0 c-db2oltp-20231117-etcd-0 pod "c-db2oltp-20231117-db2u-0" deleted pod "c-db2oltp-20231117-etcd-0" deleted [root@sphrapids2lp1 setup]# oc get pod | grep db2 c-db2oltp-20231117-db2u-0 1/1 Running 0 55s c-db2oltp-20231117-etcd-0 1/1 Running 0 65s


This blog shows you how to successfully scale a Db2 pod in terms of its vCPU and memory. The scaling of a Db2 pod allows you to add or remove more pods depending on your workload. If you have a significant number of endpoints and want to reduce the resources that your Db2 pod is using, you would scale down. Conversely, if you are performing lightweight inferencing, you can afford to scale the Db2 pod higher.

If you have any questions feel free to add a comment below or reach out to me at or