Configuring the registry for RHOSP

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.

Procedure

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

    1. apiVersion: storage.k8s.io/v1
    2. kind: StorageClass
    3. metadata:
    4. name: custom-csi-storageclass
    5. provisioner: cinder.csi.openstack.org
    6. volumeBindingMode: WaitForFirstConsumer
    7. allowVolumeExpansion: true
    8. parameters:
    9. 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:

    1. $ oc apply -f <storage_class_file_name>

    Example output

    1. storageclass.storage.k8s.io/custom-csi-storageclass 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:

    1. apiVersion: v1
    2. kind: PersistentVolumeClaim
    3. metadata:
    4. name: csi-pvc-imageregistry
    5. namespace: openshift-image-registry (1)
    6. annotations:
    7. imageregistry.openshift.io: "true"
    8. spec:
    9. accessModes:
    10. - ReadWriteOnce
    11. volumeMode: Filesystem
    12. resources:
    13. requests:
    14. storage: 100Gi (2)
    15. storageClassName: <your_custom_storage_class> (3)
    1Enter the namespace openshift-image-registry. This namespace allows the Cluster Image Registry Operator to consume the PVC.
    2Optional: Adjust the volume size.
    3Enter the name of the storage class that you created.
  4. From a command line, apply the configuration:

    1. $ oc apply -f <pvc_file_name>

    Example output

    1. persistentvolumeclaim/csi-pvc-imageregistry created
  5. Replace the original persistent volume claim in the image registry configuration with the new claim:

    1. $ oc patch configs.imageregistry.operator.openshift.io/cluster --type 'json' -p='[{"op": "replace", "path": "/spec/storage/pvc/claim", "value": "csi-pvc-imageregistry"}]'

    Example output

    1. config.imageregistry.operator.openshift.io/cluster patched

    Over the next several minutes, the configuration is updated.

Verification

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:

    1. $ oc get configs.imageregistry.operator.openshift.io/cluster -o yaml

    Example output

    1. ...
    2. status:
    3. ...
    4. managementState: Managed
    5. pvc:
    6. claim: csi-pvc-imageregistry
    7. ...
  2. Verify that the status of the PVC is Bound:

    1. $ oc get pvc -n openshift-image-registry csi-pvc-imageregistry

    Example output

    1. NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
    2. csi-pvc-imageregistry Bound pvc-72a8f9c9-f462-11e8-b6b6-fa163e18b7b5 100Gi RWO custom-csi-storageclass 11m