Exposing the registry¶
By default, the OpenShift image registry is secured during cluster installation so that it serves traffic through the Transport Layer Security (TLS) protocol. Unlike previous versions of OpenShift Container Platform, the registry is not exposed outside of the cluster at the time of installation.
Expose a default registry manually¶
Instead of logging in to the default OpenShift image registry from within the cluster, you can gain external access to the OpenShift image registry by exposing the registry with a route. With this external access, you can log in to the registry from outside the cluster by using the route address. You can then tag and push images to an existing project by using the route host.
Prerequisites
-
The following prerequisites are automatically performed:
- Deploy the Registry Operator.
- Deploy the Ingress Operator.
-
You have access to the cluster as a user with the
cluster-adminrole.
Procedure
-
To expose the registry by using the
defaultRouteparameter that exists in theconfigs.imageregistry.operator.openshift.ioresource, setdefaultRoutetotrueby running the following command: -
Get the default registry route by running the following command:
-
Get the certificate of the Ingress Operator by running the following command:
-
Move the extracted certificate to the trusted CA directory of the system by running the following command:
-
Enable the default certificate of the cluster to trust the route by running the following command:
-
Log in with podman with the default route by running the following command:
Expose a secure registry manually¶
Instead of logging in to the OpenShift image registry from within the cluster, you can gain external access to the OpenShift image registry by exposing the registry with a route. With this external access, you can log in to the registry from outside the cluster by using the route address. You can then tag and push images to an existing project by using the route host.
You can expose the route by using DefaultRoute parameter in the configs.imageregistry.operator.openshift.io resource or by using custom routes.
Prerequisites
-
The following prerequisites are automatically performed:
- Deploy the Registry Operator.
- Deploy the Ingress Operator.
-
You have access to the cluster as a user with the
cluster-adminrole.
Procedure
-
To expose the registry using
DefaultRouteparameter, setDefaultRoutetoTrue: -
Log in with
podmanby entering the following command:--tls-verify=false: Set this parameter tofalseif the default certificate of the cluster for routes is untrusted. You can set a custom, trusted certificate as the default certificate with the Ingress Operator.
-
To expose the registry using custom routes, create a secret with your route’s TLS keys. This step is optional. If you do not create a secret, the route uses the default TLS configuration from the Ingress Operator.
-
On the Registry Operator, enter the following command:
spec: routes: - name: public-routes hostname: myregistry.mycorp.organization secretName: public-route-tls ...Note
Only set
secretNameif you are providing a custom TLS configuration for the route of the registry.
Troubleshooting