Configure Registry¶
The OpenShift internal image registry is deployed by default with ephemeral storage. Images stored in the registry are lost if the registry pod is rescheduled. Configure it to use a Persistent Volume Claim (PVC).
Configure the Registry with Block Storage¶
- Go to the WebUI, click the circle plus, select Import YAML
-
Paste the following to create the PVC for the storage
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: openshift-image-registry-storage namespace: openshift-image-registry spec: accessModes: - ReadWriteMany resources: requests: storage: 100Gi storageClassName: {{ storage_class }} # Make sure this is the Filesystem storage class (cephfs) volumeMode: Filesystem
HA Filesystem Storage
RWX file storage is required for replicas: 2 (the default RollingUpdate strategy). If you only have ReadWriteOnce (RWO) block or filesystem storage, set replicas: 1 and rolloutStrategy: Recreate in the Config below.
- From the WebUI, go to Home -> API Explorer
- Filter for "Config", make sure to click on the one in Group of "imageregistry.operator.openshift.io"
-
Click on Instances tab at the top and then click on the 3 dots to the right of the cluster instance and click Edit Config
-
Watch it roll out
Configure the Registry with Object Storage¶
- Go to the WebUI and go to Storage -> Object storage
- Using the MultiCloud Object Gateway (MCG), click Create Bucket
- Change namespace to
openshift-image-registry, ObjectBucketClaim Name isregistry, keep the classes the same. - Click Create
- Copy the values for Endpoint, Bucket Name, Access Key and Secret Key.
- Go to the WebUI and in the top right hand corner, click on the circle plus icon
- Select Import YAML
-
Paste the YAML below for the secret. The image registry looks for the specific name so don't change it.
-
You have to extract the MCG endpoint CA. Extract it and add it to a configmap.
-
From the WebUI, go to Home -> API Explorer
- Filter for "Config", make sure to click on the one in Group of "imageregistry.operator.openshift.io"
- Click on Instances tab at the top and then click on the 3 dots to the right of the cluster instance and click Edit Config
-
Update the yaml
apiVersion: imageregistry.operator.openshift.io/v1 kind: Config metadata: name: cluster spec: managementState: Managed replicas: 2 storage: s3: bucket: {{ bucket_name }} region: noobaa regionEndpoint: https://s3.openshift-storage.svc:443 virtualHostedStyle: false trustedCA: name: image-registry-s3-bundle -
Watch it roll out