Configure the built-in container registry for Azure Red Hat OpenShift 4
Artikel
Azure Red Hat OpenShift provides an integrated container image registry that adds the ability to automatically provision new image repositories on demand. This provides users with a built-in location for their application builds to push the resulting images.
In this article, you'll configure the built-in container image registry for an Azure Red Hat OpenShift (ARO) 4 cluster. You'll learn how to:
Authorize an identity to access to the registry
Access the built-in container image registry from inside the cluster
Access the built-in container image registry from outside the cluster
Before you begin
This article assumes you have an existing ARO cluster (see Create an Azure Red Hat OpenShift 4 cluster). If you would like to configure Microsoft Entra integration, make sure to create the cluster with the --pull-secret argument to az aro create.
Once you have your cluster, connect to the cluster by authenticating as the kubeadmin user.
Configure authentication to the registry
For any identity (a cluster user, Microsoft Entra user, or ServiceAccount) to access the internal registry, it must be granted permissions inside the cluster:
As kubeadmin, execute the following commands:
Bash
# Note: replace "<user>" with the identity you need to access the registry
oc policy add-role-to-user -n openshift-image-registry registry-viewer <user>
oc policy add-role-to-user -n openshift-image-registry registry-editor <user>
Anteckning
For cluster users and Microsoft Entra users - this will be the same name you use to authenticate into the cluster. For OpenShift ServiceAccounts, format the name as system:serviceaccount:<project>:<name>
Access the registry
Now that you've configured authentication for the registry, you can interact with it:
From inside the cluster
If you need to access the registry from inside the cluster (e.g. you are running a CI/CD platform as Pods that will push/pull images to the registry), you can access the registry via its ClusterIP Service at the fully qualified domain name image-registry.openshift-image-registry.svc.cluster.local:5000, which is accessible to all Pods within the cluster.
From outside the cluster
If your workflows require you access the internal registry from outside the cluster (e.g. you want to push/pull images from a developer's laptop, external CI/CD platform, and/or a different ARO cluster), you will need to perform a few additional steps:
As kubeadmin, execute the following commands to expose the built-in registry outside the cluster via a Route:
Lär dig hur du skapar och konfigurerar ett Azure Container Registry, processen med att skicka containeravbildningar till Azure Container Registry och utforska olika autentiseringsmetoder och säkerhetsfunktioner för Azure Container Registry.
Demonstrera funktionerna i Microsoft Entra ID för att modernisera identitetslösningar, implementera hybridlösningar och implementera identitetsstyrning.