Image registry removed during installation

On platforms that do not provide shareable object storage, the OpenShift Image Registry Operator bootstraps itself as Removed. This allows openshift-installer to complete installations on these platform types.

After installation, you must edit the Image Registry Operator configuration to switch the ManagementState from Removed to Managed.

The Prometheus console provides an ImageRegistryRemoved alert, for example:

"Image Registry has been removed. ImageStreamTags, BuildConfigs and DeploymentConfigs which reference ImageStreamTags may not work as expected. Please configure storage and update the config to Managed state by editing"

Change image registry ManagementState

To start the image registry, you must change ManagementState Image Registry Operator configuration from Removed to Managed.

  • Change ManagementState Image Registry Operator configuration from Removed to Managed. For example:

    kind: Config
      creationTimestamp: <time>
      generation: 3
      name: cluster
      resourceVersion:  <version>
      selfLink: <link>
      readOnly: false
      disableRedirect: false
          maxInQueue: 0
          maxRunning: 0
          maxWaitInQueue: 0s
          maxInQueue: 0
          maxRunning: 0
          maxWaitInQueue: 0s
      defaultRoute: true
      managementState: Managed

Image registry storage configuration

The image-registry Operator is not initially available for platforms that do not provide default storage. After installation, you must configure your registry to use storage so the Registry Operator is made available.

Instructions for both configuring a PersistentVolume, which is required for production clusters, and for configuring an empty directory as the storage location, which is available for only non-production clusters, are shown.

Configuring registry storage for VMware vSphere

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

  • Cluster administrator permissions.

  • A cluster on VMware vSphere.

  • Provision persistent storage for your cluster. To deploy a private image registry, your storage must provide ReadWriteMany access mode.

    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.

  1. To configure your registry to use storage, change the 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.2# exportfs -rv
    exporting *:/mnt/data
  3. Check the registry configuration:

    $ oc edit

    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
        name: image-registry-pv
          - ReadWriteMany
            storage: 100Gi
          path: /registry
        persistentVolumeReclaimPolicy: Retain
        storageClassName: nfs01
      $ oc get pv
    2. Create the PVC:

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

      Finally, add the name of your PVC:

      $ oc edit -o yaml
          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

Configuring storage for the image registry in non-production clusters

You must configure storage for the image registry Operator. For non-production clusters, you can set the image registry to an empty directory. If you do so, all images are lost if you restart the registry.

  • To set the image registry storage to an empty directory:

    $ oc patch cluster --type merge --patch '{"spec":{"storage":{"emptyDir":{}}}}'

    Configure this option for only non-production clusters.

    If you run this command before the Image Registry Operator initializes its components, the oc patch command fails with the following error:

    Error from server (NotFound): "cluster" not found

    Wait a few minutes and run the command again.

Additional resources

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