Configuring an image registry with custom storage on clusters that run on RHOSP

After you install a cluster on Red Hat OpenStack Platform (RHOSP), you can use a Cinder volume that is in a specific availability zone for registry storage.

  1. Create a YAML file that specifies the storage class and availability zone to use. For example:

    kind: StorageClass
      name: custom-csi-storageclass
    volumeBindingMode: WaitForFirstConsumer
    allowVolumeExpansion: true
      availability: <availability_zone_name>

    OKD does not verify the existence of the availability zone you choose. Verify the name of the availability zone before you apply the configuration.

  2. From a command line, apply the configuration:

    $ oc apply -f <storage_class_file_name>
    Example output created
  3. Create a YAML file that specifies a persistent volume claim (PVC) that uses your storage class and the openshift-image-registry namespace. For example:

    apiVersion: v1
    kind: PersistentVolumeClaim
      name: csi-pvc-imageregistry
      namespace: openshift-image-registry (1)
      annotations: "true"
      - ReadWriteOnce
      volumeMode: Filesystem
          storage: 100Gi (2)
      storageClassName: <your_custom_storage_class> (3)
    1 Enter the namespace openshift-image-registry. This namespace allows the Cluster Image Registry Operator to consume the PVC.
    2 Optional: Adjust the volume size.
    3 Enter the name of the storage class that you created.
  4. From a command line, apply the configuration:

    $ oc apply -f <pvc_file_name>
    Example output
    persistentvolumeclaim/csi-pvc-imageregistry created
  5. Replace the original persistent volume claim in the image registry configuration with the new claim:

    $ oc patch --type 'json' -p='[{"op": "replace", "path": "/spec/storage/pvc/claim", "value": "csi-pvc-imageregistry"}]'
    Example output patched

    Over the next several minutes, the configuration is updated.


To confirm that the registry is using the resources that you defined:

  1. Verify that the PVC claim value is identical to the name that you provided in your PVC definition:

    $ oc get -o yaml
    Example output
        managementState: Managed
          claim: csi-pvc-imageregistry
  2. Verify that the status of the PVC is Bound:

    $ oc get pvc -n openshift-image-registry csi-pvc-imageregistry
    Example output
    NAME                   STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS             AGE
    csi-pvc-imageregistry  Bound    pvc-72a8f9c9-f462-11e8-b6b6-fa163e18b7b5   100Gi      RWO            custom-csi-storageclass  11m