Configuring the registry for RHOSP
You configure the image registry to use custom storage on clusters that run on RHOSP. You must configure custom storage to use a Cinder volume in a specific availability zone.
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
-
Create a YAML file that specifies the storage class and availability zone to use. For example:
apiVersion: storage.k8s.io/v1kind: StorageClassmetadata:name: custom-csi-storageclassprovisioner: cinder.csi.openstack.orgvolumeBindingMode: WaitForFirstConsumerallowVolumeExpansion: trueparameters:availability: <availability_zone_name>noteOpenShift Container Platform does not verify the existence of the availability zone you choose. Verify the name of the availability zone before you apply the configuration.
-
From a command line, apply the configuration:
$ oc apply -f <storage_class_file_name>Example outputstorageclass.storage.k8s.io/custom-csi-storageclass created -
Create a YAML file that specifies a persistent volume claim (PVC) that uses your storage class and the
openshift-image-registrynamespace. For example:apiVersion: v1kind: PersistentVolumeClaimmetadata:name: csi-pvc-imageregistrynamespace: openshift-image-registryannotations:imageregistry.openshift.io: "true"spec:accessModes:- ReadWriteOncevolumeMode: Filesystemresources:requests:storage: 100GistorageClassName: <your_custom_storage_class>where:
metadata.namespace- Specifying the
openshift-image-registrynamespace allows the Cluster Image Registry Operator to consume the PVC. spec.resources.requests.storage- This optional field adjusts the volume size.
spec.storageClassName- Specifies the name of the storage class that you created.
-
From a command line, apply the configuration:
$ oc apply -f <pvc_file_name>Example outputpersistentvolumeclaim/csi-pvc-imageregistry created -
Replace the original persistent volume claim in the image registry configuration with the new claim:
$ oc patch configs.imageregistry.operator.openshift.io/cluster --type 'json' -p='[{"op": "replace", "path": "/spec/storage/pvc/claim", "value": "csi-pvc-imageregistry"}]'Example outputconfig.imageregistry.operator.openshift.io/cluster patchedOver the next several minutes, the configuration is updated.
Verification
To confirm that the registry is using the resources that you defined:
-
Verify that the PVC claim value is identical to the name that you provided in your PVC definition:
$ oc get configs.imageregistry.operator.openshift.io/cluster -o yamlExample output...status:...managementState: Managedpvc:claim: csi-pvc-imageregistry... -
Verify that the status of the PVC is
Bound:$ oc get pvc -n openshift-image-registry csi-pvc-imageregistryExample outputNAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGEcsi-pvc-imageregistry Bound pvc-72a8f9c9-f462-11e8-b6b6-fa163e18b7b5 100Gi RWO custom-csi-storageclass 11m