Deploying Db2 on your OpenShift cluster

Before you can deploy Db2 on your cluster, you have to choose a custom resource, set up dedicated nodes within your cluster, accept license terms, and configure database storage.

Before you begin

When you have installed the Db2 Operator to your OpenShift® cluster, you use either the Db2uCluster custom resource (CR) or the Db2uInstance CR to deploy Db2. For successful deployment, you also need to set up any dedicated nodes within your cluster, accept the license terms, and configure database storage and security requirements.

The Db2uCluster CR and Db2uInstance CR

The Db2uCluster CR provides comparatively better performance on software-defined storage types, such as OpenShift Data Foundation (ODF) and Portworx. The Db2uInstance CR provides a significant performance increase on cloud platforms such as Amazon Web Services (AWS) and Azure.

Accepting the Db2 on OpenShift license terms

In order to successfully deploy Db2, the license terms detailed inside the Db2uCluster and Db2uInstance custom resource topics need to be reviewed and accepted inside the Db2 Custom Resource.

Storage requirements

The storage class must exist in the cluster or a supported storage class must be provided accordingly. To deploy Db2, you need a supported storage class.

During a Db2 deployment, storage can be dynamically created or pre-created PVs can be specified. Db2 needs the following storage locations:
  • System & Backup storage [Shared with RWX]
    • Db2 instance home directory
    • Diagnostic logs
    • Other global configuration directories
    • Backups, Restore or Load locations
  • User storage [Exclusive with RWO]
    • Database storage paths
    • Transaction logs
Software-defined Shared Zone [Meta] Data Zone [Data]
NFS Access Mode: RWX RWX (combined with Meta) or RWO
Portworx 2.9.1.3 Shared v4, RWX (based on NFS v4 protocol) io-profile: db_remote, RWO
ODF 4.12 or greater CephFS, RWX CephRBD(Block Device), RWO
Spectrum Scale CSI 2.1 or greater RWX RWO
Note: In cases where the storage layer supports it, a single storage location, defined as RWX, can be specified. Such a configuration would exhibit degraded performances.

PodSecurityPolicy Requirements

The Db2 deployment is currently only supported on Red Hat OpenShift.

SecurityContextConstraints Requirements

The Db2 deployment requires the following SCC:
kind: SecurityContextConstraints
apiVersion: security.openshift.io/v1
apiGroup: security.openshift.io
metadata:
    name: db2u-scc
allowHostDirVolumePlugin: false
allowHostIPC: false
allowHostNetwork: false
allowHostPID: false
allowHostPorts: false
# privileged container is only needed for the init container that sets the Db2 kernel parameters
allowPrivilegedContainer: true
allowedCapabilities:
- "SYS_RESOURCE"
- "IPC_OWNER"
- "SYS_NICE"
- "CHOWN"
- "DAC_OVERRIDE"
- "FSETID"
- "FOWNER"
- "SETGID"
- "SETUID"
- "SETFCAP"
- "SETPCAP"
- "SYS_CHROOT"
- "KILL"
- "AUDIT_WRITE"
priority: 10
runAsUser:
    type: RunAsAny
seLinuxContext:
    type: MustRunAs
fsGroup:
    type: RunAsAny
supplementalGroups:
    type: RunAsAny
version: v1