Creating persistent volumes in IBM Cloud Private

Creating persistent volumes in your ICP cluster to work with the containerized UrbanCode Deploy server.

Before you begin

If your cluster supports dynamic storage provisioning, you can use it to manage storage after you install UrbanCode Deploy in your cluster. If your cluster does not supports dynamic storage provisioning, you need to configure persistent storage that can be mounted by all nodes in your cluster. For example, you might setup an NFS server with several directories.

Note:

To create a persistent volume, you must be a super administrator or application administrator.

About this task

A persistent volume, as used here, is networked storage in an ICP cluster that is provisioned by an administrator. PVs are available to all applications in the cluster. A persistent volume claim is a request for cluster storage, and is typically made by a user. Each PVC is bound to a single persistent volume. ICP supports all Kubernetes persistent volume types.

If your cluster does not support dynamic storage provisioning, create two persistent volumes in your cluster, and then create persistent volume claims and attach them to the persistent volumes. One volume holds the database drivers and the other holds the UrbanCode Deploy server's /appdata directory.

If your cluster supports dynamic storage provisioning, such as GlusterFS, you still need to copy the JDBC drivers to the extLib PV. You can use a ConfigMap to automate copying. A sample ConfigMap is described later.

Procedure

  1. Create a PV and a PVC for the server's /appdata directory by completing the following steps:
    1. On your ICP Dashboard, click Platform > Storage > Create PersistentVolume.
    2. Define the persistent volume's parameters:
      1. Name and capacity.
      2. Access mode
      3. Reclaim policy
      4. Storage type. If you use the Create Persistent Volume window to create new storage, only NFS, GlusterFS, or Hostpath can be selected. To use other types of storage, use the Create resource option instead.
      5. Parameters for storage. This value depends on the type of storage you select. For example, if you choose NFS storage, specify the server and path for the storage.
    3. Click Create. The new persistent volume is displayed in the PV list. The volume should have a state of Available.
    4. Click Storage > PersistentVolume Claim > Create PersistentVolume Claim.
    5. Define the persistent volume claim parameters:
      1. Name
      2. Storage requests
      3. Access mode. For volumes that support multiple access modes, specify the required mode.
    6. Click Create. The new claim is displayed in the PVC list.
  2. Create a PV, ext_lib, and PVC for the database drivers by completing the following steps.
    1. Create a PV and then copy the database drivers to it.
    2. Create a PVC for the persistent volume you created in the previous step and attach it to the PV.
  3. Optional: If your cluster supports dynamic storage provisioning, you can create a ConfigMap resource that contains a shell script that copies the JDBC driver files to the extLib PV.

    This sample yaml file describes a ConfigMap resource with a shell script, named script.sh. The script performs a wget command to pull the MySQL.jar file from a web server and copy it to the ${UCD_HOME}/ext_lib/ directory in the container. In order for the image initialization code to find and execute the script, the script must be named script.sh.

    kind: ConfigMap
    apiVersion: v1
    metadata:
      name: user-script
    data:
      script.sh: |
        #!/bin/bash
        echo "Running script.sh..."
        if [ ! -f ${UCD_HOME}/ext_lib/mysql-jdbc.jar ] ; then
          which wget
          if [ $? -ne 0 ]; then
            apt-get update -y
            echo "Installing wget..."
            apt-get install wget -y
          fi
          echo "Copying file(s)..."    
          wget http://hostname/ucd-extlib/mysql-jdbc.jar
          mv mysql-jdbc.jar ${UCD_HOME}/ext_lib/
          echo "Done copying."
        else
          echo "File ${UCD_HOME}/ext_lib/mysql-jdbc.jar already exists."
        fi

Feedback