Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 2. Image Registry Operator in OpenShift Container Platform
2.1. Image Registry on cloud platforms and OpenStack Copier lienLien copié sur presse-papiers!
The Image Registry Operator installs a single instance of the OpenShift image registry and manages all registry configuration, including setting up registry storage.
Storage is only automatically configured when you install an installer-provisioned infrastructure cluster on AWS, Azure, Google Cloud, IBM®, or RHOSP.
When you install or upgrade an installer-provisioned infrastructure cluster on AWS, Azure, Google Cloud, IBM®, or RHOSP, the Image Registry Operator sets the spec.storage.managementState parameter to Managed. If the spec.storage.managementState parameter is set to Unmanaged, the Image Registry Operator takes no action related to storage.
After the control plane deploys in the management cluster, the Operator creates a default configs.imageregistry.operator.openshift.io custom resource (CR) instance based on configuration detected in the cluster.
If insufficient information is available to define a complete configs.imageregistry.operator.openshift.io CR, the incomplete resource is defined and the Operator updates the resource status with information about what is missing.
The Image Registry Operator’s behavior for managing the pruner is orthogonal to the managementState specified on the ClusterOperator object for the Image Registry Operator. If the Image Registry Operator is not in the Managed state, the image pruner can still be configured and managed by the Pruning custom resource.
However, the managementState of the Image Registry Operator alters the behavior of the deployed image pruner job:
-
Managed: the--prune-registryflag for the image pruner is set totrue. -
Removed: the--prune-registryflag for the image pruner is set tofalse, meaning the image pruner job only prunes image metadata in etcd.
2.2. Image Registry on bare metal, Nutanix, and vSphere Copier lienLien copié sur presse-papiers!
2.2.1. Image registry removed during installation Copier lienLien copié sur presse-papiers!
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. After this task has completed, you must configure storage.
2.3. Image Registry Operator distribution across availability zones Copier lienLien copié sur presse-papiers!
The default configuration of the Image Registry Operator spreads image registry pods across topology zones to prevent delayed recovery times in case of a complete zone failure where all pods are impacted. Reference the following YAML to understand the default parameter values that the Image Registry Operator uses when the Operator deploys with a zone-related topology constraint:
Reference the following YAML to understand the default parameter value that the Image Registry Operator uses when the Operator deploys with a zone-related topology constraint, which applies to bare metal and vSphere instances:
As a cluster administrator. you can override the default topologySpreadConstraints section values by configuring the configs.imageregistry.operator.openshift.io/cluster spec file.
2.5. Image Registry Operator configuration parameters Copier lienLien copié sur presse-papiers!
The configs.imageregistry.operator.openshift.io resource offers the following configuration parameters.
| Parameter | Description |
|---|---|
|
|
|
|
|
Sets
The following values for
|
|
| Value needed by the registry to secure uploads, generated by default. |
|
|
The
The following values for
|
|
| Defines the Proxy to be used when calling master API and upstream registries. |
|
|
You can use the
Affinity settings can use the |
|
|
|
|
| Indicates whether the registry instance should reject attempts to push new images or delete existing ones. |
|
| API Request Limit details. Controls how many parallel requests a given registry instance will handle before queuing additional requests. |
|
|
Determines whether or not an external route is defined using the default hostname. If enabled, the route uses re-encrypt encryption. Defaults to |
|
| Array of additional routes to create. You provide the hostname and certificate for the route. |
|
|
Defines rollout strategy for the image registry deployment. Defaults to |
|
| Replica count for the registry. |
|
|
Controls whether to route all data through the registry, rather than redirecting to the back end. Defaults to |
|
|
The Image Registry Operator sets the
|
2.6. Enabling the Image Registry default route by using a CRD Copier lienLien copié sur presse-papiers!
In OpenShift Container Platform, the Registry Operator controls the OpenShift image registry feature and you define this Operator in the configs.imageregistry.operator.openshift.io Custom Resource Definition (CRD). If you need to automatically enable the Image Registry default route, patch the Image Registry Operator CRD.
Procedure
Patch the Image Registry Operator CRD:
oc patch configs.imageregistry.operator.openshift.io/cluster --type merge -p '{"spec":{"defaultRoute":true}}'$ oc patch configs.imageregistry.operator.openshift.io/cluster --type merge -p '{"spec":{"defaultRoute":true}}'Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.7. Configuring additional trust stores for image registry access Copier lienLien copié sur presse-papiers!
You can update an image.config.openshift.io/cluster custom resource (CR) to include a reference to a config map that includes additional certificate authorities (CAs). You must ensure that these CAs are trusted during image registry access. The config map key is the hostname of a registry with the port for which this CA is to be trusted. The Privacy-Enhanced Mail (PEM) certificate content is the value, for each additional registry CA to trust.
Prerequisites
- Ensure that a CA is PEM-encoded.
Procedure
Create a config map in the
openshift-confignamespace. The following example configurations show defined image registry CA that exists in a config map:Copy to Clipboard Copied! Toggle word wrap Toggle overflow where:
registry-with-port.example.com..5000-
If the registry has the port,
:should be replaced with...
Configure an additional CA. Ensure that you specify the name of the CA in the AdditionalTrustedCA` parameter of the
image.config.openshift.ioCR. You can then provide additional CAs that must be trusted when contacting external registries.oc create configmap registry-config --from-file=<external_registry_address>=ca.crt -n openshift-config
$ oc create configmap registry-config --from-file=<external_registry_address>=ca.crt -n openshift-configCopy to Clipboard Copied! Toggle word wrap Toggle overflow oc edit image.config.openshift.io cluster
$ oc edit image.config.openshift.io clusterCopy to Clipboard Copied! Toggle word wrap Toggle overflow spec: additionalTrustedCA: name: registry-configspec: additionalTrustedCA: name: registry-configCopy to Clipboard Copied! Toggle word wrap Toggle overflow
2.8. Configuring storage credentials for the Image Registry Operator Copier lienLien copié sur presse-papiers!
In addition to the configs.imageregistry.operator.openshift.io Custom Resource (CR) and ConfigMap resources, storage credential configuration is provided to the Operator by a separate secret resource. This resource is located within the openshift-image-registry namespace.
You can create an image-registry-private-configuration-user secret that in turn creates custom credentials needed for storage access and management. If default credentials exist, the custom credentials override the default credentials used by the Operator.
Procedure
Create an OpenShift Container Platform secret that contains the required keys.
oc create secret generic image-registry-private-configuration-user --from-literal=KEY1=value1 --from-literal=KEY2=value2 --namespace openshift-image-registry
$ oc create secret generic image-registry-private-configuration-user --from-literal=KEY1=value1 --from-literal=KEY2=value2 --namespace openshift-image-registryCopy to Clipboard Copied! Toggle word wrap Toggle overflow