Configure OpenShift Image Registry to use NFS

Pradipta Banerjee
2 min readMay 29, 2020

--

OpenShift provides a built in Container Image Registry for working with container images. The Registry is configured and managed by the Image Registry Operator. It runs in the openshift-image-registry namespace.

In case you want to see detailed information about the image registry operator, run the following command:

oc describe configs.imageregistry.operator.openshift.io

In case you want to see the PODs created by the image registry operator, run the following command:

oc get pods -n openshift-image-registry

Follow these steps to use NFS storage for the Image Registry

Create NFS Persistent Volume Claim

Following is an example YAML to create NFS PVC:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: registrypvc
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 100Gi
storageClassName: managed-nfs-storage

Run the following commands to create PVC in the openshift-image-registry namespace and configure the Image Registry to use the NFS PVC:

$ oc project openshift-image-registry$ oc create -f pvc-nfs.yaml
persistentvolumeclaim/registrypvc created

Run the following command to check the status of the PVC:

$ oc get pvc
<this should show the registrypvc status as Bound>

Run the following command to update the Image Registry to use the NFS PVC:

$ oc patch configs.imageregistry.operator.openshift.io cluster --type merge --patch '{"spec":{"storage":{"pvc":{"claim":"registrypvc"}}, "managementState": "Managed"}}'

For verification, you can check the /registry mountpoint inside the image-registry pod. Run the following commands:

$ oc get pods -o name
pod/cluster-image-registry-operator-6bf6d5449-c7rk4
pod/image-registry-7bc75dddd7-jbqhg
pod/node-ca-678l7
pod/node-ca-l885z
pod/node-ca-mvwft
pod/node-ca-vwh5t
pod/node-ca-x7rd6
$ oc rsh image-registry-7bc75dddd7-jbqhg
sh-4.2$ mount | grep registry
<this should show the NFS mountpoint>

--

--

Pradipta Banerjee
Pradipta Banerjee

Written by Pradipta Banerjee

Writes about technology | Startup advisor & mentor. www.linkedin.com/in/bpradipt

No responses yet