×

Configuring registry storage for VMware vSphere

As a cluster administrator, following installation you must configure your registry to use storage.

Prerequisites
  • Cluster administrator permissions.

  • A cluster on VMware vSphere.

  • A provisioned persistent volume (PV) with ReadWriteMany access mode, such as NFS.

    vSphere volumes do not support the ReadWriteMany access mode. You must use a different storage backend, such as NFS, to configure the registry storage.

  • Must have "100Gi" capacity.

Procedure
  1. To configure your registry to use storage, change the spec.storage.pvc in the configs.imageregistry/cluster resource.

  2. Verify you do not have a registry Pod:

    $ oc get pod -n openshift-image-registry

    If the storage type is emptyDIR, the replica number cannot be greater than 1. If the storage type is NFS, and you want to scale up the registry Pod by setting replica>1 you must enable the no_wdelay mount option. For example:

    # cat /etc/exports
    /mnt/data *(rw,sync,no_wdelay,no_root_squash,insecure,fsid=0)
    sh-4.3# exportfs -rv
    exporting *:/mnt/data
  3. Check the registry configuration:

    $ oc edit configs.imageregistry.operator.openshift.io
    
    storage:
      pvc:
        claim:

    Leave the claim field blank to allow the automatic creation of an image-registry-storage PVC.

  4. Optional: Add a new storage class to a PV:

    1. Create the PV:

      $ oc create -f -
      apiVersion: v1
      kind: PersistentVolume
      metadata:
        name: image-registry-pv
      spec:
        accessModes:
          ReadWriteMany
          capacity:
            storage: 100Gi
        nfs:
          path: /registry
          server: 172.16.231.181
        persistentVolumeReclaimPolicy: Retain
        storageClassName: nfs01
      $ oc get pv
    2. Create the PVC:

      $ oc create -n openshift-image-registry -f -
      apiVersion: "v1"
      kind: "PersistentVolumeClaim"
      metadata:
        name: "image-registry-pvc"
      spec:
        accessModes:
          - ReadWriteMany
        resources:
          requests:
            storage: 100Gi
        storageClassName: nfs01
        volumeMode: Filesystem
      $ oc get pvc -n openshift-image-registry

      Finally, add the name of your PVC:

      $ oc edit configs.imageregistry.operator.openshift.io -o yaml
      storage:
        pvc:
          claim: image-registry-pvc (1)
      1 Creating a custom PVC allows you to leave the claim field blank for default automatic creation of an image-registry-storage PVC.
  5. Check the clusteroperator status:

    $ oc get clusteroperator image-registry

Additional resources

For more details on configuring registry storage for vSphere, see Recommended configurable storage technology.