IBM Support

Sample YAML scripts for deploying Db2 and Db2 Warehouse on GCP

General Page

Run these scripts to deploy a Db2 OLTP, Db2 Warehouse SMP, or Db2 Warehouse MPP instance on a Google Cloud Platform (GCP) cluster.

YAML for a Db2 OLTP instance

The following code deploys an instance of Db2 OLTP on GCP. This instance uses separate storage for metadata (Filestore), data (Persistent Disk), active logs (Persistent Disk), temporary tablespaces (Persistent Disk), backups (Filestore), and archive logs (Filestore).

cat << EOF | kubectl create -f -
apiVersion: db2u.databases.ibm.com/v1
kind: Db2uInstance
metadata:
  name: db2oltp-test
  namespace: ${NAMESPACE}
spec:
  podTemplate:
    db2u:
      resource:
        db2u:
          limits:
            cpu: 6
            memory: 24Gi
  environment:
    authentication:
      ldap:
        enabled: false
    databases:
     - name: BLUDB
       storage:
         - name: data
           type: template
           spec:
             accessModes:
               - ReadWriteOnce
             resources:
               requests:
                 storage: 10Gi
             storageClassName: standard-rwo
         - name: activelogs
           type: template
           spec:
             accessModes:
               - ReadWriteOnce
             resources:
               requests:
                 storage: 10Gi
             storageClassName: standard-rwo
         - name: tempts
           type: template
           spec:
             accessModes:
               - ReadWriteOnce
             resources:
               requests:
                 storage: 10Gi
             storageClassName: standard-rwo
    dbType: db2oltp
  license:
    accept: true
  nodes: 1
  storage:
    - name: meta
      spec:
        accessModes:
          - ReadWriteMany
        resources:
          requests:
            storage: 10Gi
        storageClassName: standard-db2u-rwx
      type: create
    - name: backup
      spec:
        accessModes:
          - ReadWriteMany
        resources:
          requests:
            storage: 10Gi
        storageClassName: standard-db2u-rwx
      type: create
    - name: archivelogs
      spec:
        accessModes:
        - ReadWriteMany
        resources:
          requests:
            storage: 10Gi
        storageClassName: standard-db2u-rwx
      type: create
  version: s12.1.4.0
EOF

 

YAML for a Db2 Warehouse SMP instance

The following code deploys a single partition (SMP) instance of Db2 Warehouse on GCP. This single‑partition Warehouse instance uses Filestore for metadata, backups, and archive logs, and Persistent Disk for data and temporary tablespaces.

cat << EOF | kubectl apply -f -
apiVersion: db2u.databases.ibm.com/v1
kind: Db2uInstance
metadata:
  name: db2whsmp-test
  namespace: ${NAMESPACE}
spec:
  version: s12.1.4.0
  nodes: 1
  environment:
    dbType: db2wh
    databases:
      - name: BLUDB
    partitionConfig:
      total: 1
    authentication:
      ldap:
        enabled: false        
  license:
    accept: true
  storage:
  - name: meta
    spec:
      accessModes:
      - ReadWriteMany
      resources:
        requests:
          storage: 20Gi
      storageClassName: standard-db2u-rwx
    type: create
  - name: data
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 100Gi
      storageClassName: standard-rwo
    type: template
  - name: backup
    spec:
      accessModes:
      - ReadWriteMany
      resources:
        requests:
          storage: 10Gi
      storageClassName: standard-db2u-rwx
    type: create
  - name: tempts
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 10Gi
      storageClassName: standard-rwo
    type: template 
  - name: archivelogs
    spec:
      accessModes:
      - ReadWriteMany
      resources:
        requests:
          storage: 10Gi
      storageClassName: standard-db2u-rwx
    type: create     
EOF

Important: For Db2 Warehouse MPP deployments, ensure your GKE cluster has sufficient worker nodes with large enough GCP instance types to meet the resource requirements defined in the YAML. Insufficient node pool resources will cause Db2u pods and PVCs to remain in Pending state due to Kubernetes scheduling constraints.

Each worker node must also have sufficient CPU and memory to support the
values defined in the podTemplate section. The per-node CPU and memory
limits must fit within the capacity of a single Kubernetes node. Otherwise,
pods may remain Pending with Insufficient CPU or Insufficient memory
scheduling errors.

For MPP deployments, calculate per-node CPU and memory by distributing the target total sizing across the number of nodes specified in spec.nodes.
These values should align with the Db2 Warehouse sizing guidelines in Choosing a GCP VM instance type and maintain the recommended
memory‑to‑CPU ratio (8:1–32:1, target ≥16:1).

Example:
A small MPP configuration targeting approximately 38 vCPUs and 608 GB of
memory across 6 nodes results in ~13 vCPUs and ~104 Gi of memory per node. This configuration fits within an n2-highmem-16 instance type.

 

The following code deploys a multi-partition (MPP) instance of Db2 Warehouse on GCP, targeting 360 vCPUs and 2,880 GB of memory across six nodes, intended for instance types n2-highmem-64 or larger. This multi‑partition Warehouse instance uses shared Filestore for metadata, backups, and archive logs. Each partition uses Persistent Disk for data and temporary tablespaces. 

cat << EOF | kubectl apply -f -
apiVersion: db2u.databases.ibm.com/v1
kind: Db2uInstance
metadata:
  name: db2whmpp-test
  namespace: ${NAMESPACE}
spec:
  version: s12.1.4.0
  nodes: 6
  podTemplate:
    db2u:
      resource:
        db2u:
          limits:
            cpu: "60"
            memory: "480Gi"    
  environment:
    dbType: db2wh
    databases:
      - name: BLUDB
    partitionConfig:
      total: 84 
      volumePerPartition: true 
    authentication:
      ldap:
        enabled: false        
  license:
    accept: true
  storage:
  - name: meta
    spec:
      accessModes:
      - ReadWriteMany
      resources:
        requests:
          storage: 20Gi
      storageClassName: standard-db2u-rwx
    type: create
  - name: data
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 100Gi
      storageClassName: standard-rwo
    type: template
  - name: backup
    spec:
      accessModes:
      - ReadWriteMany
      resources:
        requests:
          storage: 100Gi
      storageClassName: standard-db2u-rwx
    type: create
  - name: tempts
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 10Gi
      storageClassName: standard-rwo
    type: template  
  - name: archivelogs
    spec:
      accessModes:
      - ReadWriteMany
      resources:
        requests:
          storage: 10Gi
      storageClassName: standard-db2u-rwx
    type: create        
EOF

 

Related links

Deploying Db2 or Db2 Warehouse on Google Cloud Platform
Db2 and Db2 Warehouse containerized deployments

[{"Type":"MASTER","Line of Business":{"code":"LOB10","label":"Data and AI"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"ARM Category":[{"code":"a8m3p000000LPvoAAG","label":"Openshift"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"12.1.4"}]

Document Information

Modified date:
13 May 2026

UID

ibm17263208