Resizing the Backup and Restore PVC

Resize the Persistent Volume Claim (PVC) that you use for backups by moving the PVC data to a temporary PVC and then back again to the resized one.

Before you begin

  • The Red Hat OpenShift CLI client helps you develop, build, deploy, and run your applications on any Red Hat OpenShift or Kubernetes cluster. It also includes the administrative commands for managing a cluster under the adm subcommand.

    1. Download Red Hat OpenShift CLI 4.10 or later from https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/stable-4.10/. The file to download is called openshift-client-<platform>-<version>.tar.gz.
    2. Extract the binary file that you downloaded by typing the following command, where <oc_cli_archive_file> is the name of the archive file that you downloaded.
      tar -xf <oc_cli_archive_file>
    3. Modify the permissions of the binary file by typing the following command, where <oc_cli_binary> is the name of the Red Hat OpenShift binary that you extracted from the archive.
      chmod 755 <oc_cli_binary>
    4. Move the binary file to the /usr/local/bin directory by typing the following command.
      mv <oc_cli_binary> /usr/local/bin/oc
      Tip: If this command returns a No such file or directory or Not a directory error message, create the /usr/local/bin directory by typing the following command.
      sudo mkdir /usr/local/bin
    5. Ensure that the Red Hat OpenShift CLI client is working by typing the following command.
      oc version
      Tip: MacOS users might see a message that this tool cannot be opened because it is from an unidentified developer. Close this message and go to System Preferences > Security & Privacy. On the General tab, click Open Anyway or Allow Anyway. Repeat the oc version command.
  1. Back up your QRadar® Suite Software data before you follow this procedure. For more information about backups, see Backup and restore.
  2. Gather the following information.
    • The namespace in which QRadar Suite Software is installed.
    • The storageClass used for the QRadar Suite Software deployment.
    • The new size of the PVC to create. The new size must be larger than the current PVC size.
    • The repository URL, if your QRadar Suite Software deployment is in an air-gapped environment.
  3. This procedure is for deployments where the storage class used does not support volume expansion, such as VMware thin storage. Check whether your storage class supports volume expansion by typing the following command:
    oc describe sc <storage_class> | grep AllowVolumeExpansion

    If the value is set to True, follow the Modifying QRadar Suite Software deployment resource specifications procedure to resize the PVC.

    If the value is set to False, follow this procedure to resize the PVC.

Procedure

  1. Log in to your Red Hat OpenShift Container Platform cluster as a cluster administrator by typing one of the following commands, where <openshift_url> is the URL for your Red Hat OpenShift Container Platform environment.
    • Using a username and password.
      oc login <openshift_url> -u <cluster_admin_user> -p <cluster_admin_password>
    • Using a token.
      oc login --token=<token> --server=<openshift_url>
  2. Switch to your QRadar Suite Software namespace by typing the following command.
    oc project <cp4s_namespace>

    For example, if your QRadar Suite Software namespace is cp4sexample, type the following command.

    oc project cp4sexample

    The following example output shows that you have switched to the cp4sexample namespace.

    Now using project "cp4sexample" on server "https://example.com:6443".
  3. Clone the cp4s-configuration repository in your working directory.
    1. If you don't already have one, create a working directory by typing the following command.
      mkdir <working_directory>
    2. Go to your working directory by typing the following command.
      cd <working_directory>
    3. Clone the cp4s-configuration repository by typing the following command.
      git clone https://github.com/cp4sec/cp4s-configuration.git
    4. Go to the resize-pvcs/backup directory by typing the following command.
      cd cp4s-configuration/resize-pvc/backup
  4. Create a temporary PVC.
    1. Edit temp-pvc.yaml to set the namespace, storageClassName, and storage parameters that are required for your deployment.
    2. Create a temporary PVC by typing the following command.
      oc apply -f temp-pvc.yaml
      The expected output of this command is:
      persistentvolumeclaim/temp-pvc-0 created
  5. Scale down the backup and restore instance by typing the following command.
    oc scale --replicas=0 deployment/cp4s-backup-restore
  6. Move the PVC data within a temporary pod.
    1. If your QRadar Suite Software deployment is in an air-gapped environment, update the image parameter in busybox-swap-pvc-0.yaml.
    2. Start the busybox pod by typing the following command.
      oc apply -f busybox-swap-pvc-0.yaml
    3. Confirm that the pods are in the Running state by typing the following command.
      oc get pods | grep busybox-swap-pvc
      The expected output of this command is
      busybox-swap-pvc-0    1/1     Running            0          14s
    4. Copy the content from the busybox pod into the temporary PVC by typing the following command.
      oc exec busybox-swap-pvc-0 -- /bin/sh -c "cp -rp data-source/* data-destination" 
    5. Delete the busybox pod by typing the following command.
      oc delete pod busybox-swap-pvc-0
  7. Delete the original PVC by typing the following command.
    oc delete pvc cp4s-backup-pv-claim
    The expected output of this command is:
    persistentvolumeclaim "cp4s-backup-pv-claim" deleted
  8. Create a new PVC with the required size.
    1. Edit new-pvc.yaml to set the namespace, storageClassName, and storage parameters that are required for your deployment.
    2. Create a temporary PVC by typing the following command.
      oc apply -f new-pvc.yaml
      The expected output of this command is:
      persistentvolumeclaim/cp4s-backup-pv-claim
  9. Copy the PVC data from the temporary PVC to the new PVC.
    1. If your QRadar Suite Software deployment is in an air-gapped environment, update the image parameter in busybox-swap-pvc-0.yaml.
    2. Start the busybox pod by typing the following command.
      oc apply -f busybox-swap-pvc-0.yaml
    3. Confirm that the pods are in the Running state by typing the following command.
      oc get pods | grep busybox-swap-pvc
      The expected output of this command is
      busybox-swap-pvc-0    1/1     Running            0          14s
    4. Copy the content from the busybox pod into the temporary PVC by typing the following command.
      oc exec busybox-swap-pvc-0 -- /bin/sh -c "cp -rp data-destination/* data-source"
    5. Delete the busybox pod by typing the following command.
      oc delete pod busybox-swap-pvc-0
  10. Scale up the backup and restore instance by typing the following command.
    oc scale --replicas=1 deployment/cp4s-backup-restore
  11. Validate the QRadar Suite Software application, then delete the temporary PVC by typing the following command.
    oc delete pvc temp-pvc-0