|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * registry/configuring_registry_storage/configuring-registry-storage.adoc |
| 4 | + |
| 5 | +[id="installation-registry-osp-creating-custom-pvc_{context}"] |
| 6 | += Configuring an image registry with custom storage on clusters that run on {rh-openstack} |
| 7 | + |
| 8 | +After you install a cluster on {rh-openstack-first}, you can use a Cinder volume that is in a specific availability zone for registry storage. |
| 9 | + |
| 10 | +.Procedure |
| 11 | + |
| 12 | +. Create a YAML file that specifies the storage class and availability zone to use. For example: |
| 13 | ++ |
| 14 | +[source,yaml] |
| 15 | +---- |
| 16 | +apiVersion: storage.k8s.io/v1 |
| 17 | +kind: StorageClass |
| 18 | +metadata: |
| 19 | + name: custom-csi-storageclass |
| 20 | +provisioner: cinder.csi.openstack.org |
| 21 | +volumeBindingMode: WaitForFirstConsumer |
| 22 | +allowVolumeExpansion: true |
| 23 | +parameters: |
| 24 | + availability: <availability_zone_name> |
| 25 | +---- |
| 26 | ++ |
| 27 | +[NOTE] |
| 28 | +==== |
| 29 | +{product-title} does not verify the existence of the availability zone you choose. Verify the name of the availability zone before you apply the configuration. |
| 30 | +==== |
| 31 | + |
| 32 | +. From a command line, apply the configuration: |
| 33 | ++ |
| 34 | +[source,terminal] |
| 35 | +---- |
| 36 | +$ oc apply -f <storage_class_file_name> |
| 37 | +---- |
| 38 | ++ |
| 39 | +.Example output |
| 40 | +[source,terminal] |
| 41 | +---- |
| 42 | +storageclass.storage.k8s.io/custom-csi-storageclass created |
| 43 | +---- |
| 44 | + |
| 45 | +. Create a YAML file that specifies a persistent volume claim (PVC) that uses your storage class and the `openshift-image-registry` namespace. For example: |
| 46 | ++ |
| 47 | +[source,yaml] |
| 48 | +---- |
| 49 | +apiVersion: v1 |
| 50 | +kind: PersistentVolumeClaim |
| 51 | +metadata: |
| 52 | + name: csi-pvc-imageregistry |
| 53 | + namespace: openshift-image-registry <1> |
| 54 | + annotations: |
| 55 | + imageregistry.openshift.io: "true" |
| 56 | +spec: |
| 57 | + accessModes: |
| 58 | + - ReadWriteOnce |
| 59 | + volumeMode: Block |
| 60 | + resources: |
| 61 | + requests: |
| 62 | + storage: 100Gi <2> |
| 63 | + storageClassName: <your_custom_storage_class> <3> |
| 64 | +---- |
| 65 | +<1> Enter the namespace `openshift-image-registry`. This namespace allows the Cluster Image Registry Operator to consume the PVC. |
| 66 | +<2> Optional: Adjust the volume size. |
| 67 | +<3> Enter the name of the storage class that you created. |
| 68 | + |
| 69 | +. From a command line, apply the configuration: |
| 70 | ++ |
| 71 | +[source,terminal] |
| 72 | +---- |
| 73 | +$ oc apply -f <pvc_file_name> |
| 74 | +---- |
| 75 | ++ |
| 76 | +.Example output |
| 77 | +[source,terminal] |
| 78 | +---- |
| 79 | +persistentvolumeclaim/csi-pvc-imageregistry created |
| 80 | +---- |
| 81 | + |
| 82 | +. Replace the original persistent volume claim in the image registry configuration with the new claim: |
| 83 | ++ |
| 84 | +[source,terminal] |
| 85 | +---- |
| 86 | +$ oc patch configs.imageregistry.operator.openshift.io/cluster --type 'json' -p='[{"op": "replace", "path": "/spec/storage/pvc/claim", "value": "csi-pvc-imageregistry"}]' |
| 87 | +---- |
| 88 | ++ |
| 89 | +.Example output |
| 90 | +[source,terminal] |
| 91 | +---- |
| 92 | +config.imageregistry.operator.openshift.io/cluster patched |
| 93 | +---- |
| 94 | ++ |
| 95 | +Over the next several minutes, the configuration is updated. |
| 96 | + |
| 97 | +.Verification |
| 98 | + |
| 99 | +To confirm that the registry is using the resources that you defined: |
| 100 | + |
| 101 | +. Verify that the PVC claim value is identical to the name that you provided in your PVC definition: |
| 102 | ++ |
| 103 | +[source,terminal] |
| 104 | +---- |
| 105 | +$ oc get configs.imageregistry.operator.openshift.io/cluster -o yaml |
| 106 | +---- |
| 107 | ++ |
| 108 | +.Example output |
| 109 | +[source,terminal] |
| 110 | +---- |
| 111 | +... |
| 112 | +status: |
| 113 | + ... |
| 114 | + managementState: Managed |
| 115 | + pvc: |
| 116 | + claim: csi-pvc-imageregistry |
| 117 | +... |
| 118 | +---- |
| 119 | + |
| 120 | +. Verify that the status of the PVC is `Bound`: |
| 121 | ++ |
| 122 | +[source,terminal] |
| 123 | +---- |
| 124 | +$ oc get pvc -n openshift-image-registry csi-pvc-imageregistry |
| 125 | +---- |
| 126 | ++ |
| 127 | +.Example output |
| 128 | +[source,terminal] |
| 129 | +---- |
| 130 | +NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE |
| 131 | +csi-pvc-imageregistry Bound pvc-72a8f9c9-f462-11e8-b6b6-fa163e18b7b5 100Gi RWO custom-csi-storageclass 11m |
| 132 | +---- |
0 commit comments