External Storage (NFS)

The following example shows how to apply external storage for the Image Registry Operator.

Attention

The following assumes an NFS share is already created on the network and operational. If not see NFS Server & Client.

Create the PV

  1. Create the PV yaml file

    cat << EOF | oc create -f -
    apiVersion: v1
    kind: PersistentVolume
    metadata:
      name: bfg-nfs1
    spec:
      capacity:
        storage: 200Gi
      accessModes:
      - ReadWriteMany
      nfs:
        path: /mirror/nfs
        server: 192.168.1.72
      persistentVolumeReclaimPolicy: Retain
    EOF
    
  2. Verify the PV

    oc get pv
    
    NAME       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS
    bfg-nfs1   200Gi      RWO            Retain           Available
    

Create the PVC

Important

The pvc needs to match the pv’s “accessModes”, “storage”, and “volumeName”.

  1. Create the PVC yaml file

    cat << EOF | oc create -f -
    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      annotations:
        imageregistry.openshift.io: "true"
      finalizers:
      - kubernetes.io/pvc-protection
      name: image-registry-storage
      namespace: openshift-image-registry
    spec:
      accessModes:
      - ReadWriteMany
      resources:
        requests:
          storage: 200Gi
      volumeMode: Filesystem
      volumeName: bfg-nfs1
    EOF
    
  2. Verifiy the PVC

    oc get pvc
    
    NAME                     STATUS   VOLUME     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
    image-registry-storage   Bound    bfg-nfs1   200Gi      RWO                           22h
    
    oc get pv
    
    NAME       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS      CLAIM
    bfg-nfs1   200Gi      RWO            Retain           Bound       openshift-image-registry/image-registry-storage