This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.Este conteúdo não está disponível no idioma selecionado.
Chapter 3. Configuring registry storage
3.1. Configuring registry storage for AWS user-provisioned infrastructure Copiar o linkLink copiado para a área de transferência!
3.1.1. Configuring a secret for the Image Registry Operator Copiar o linkLink copiado para a área de transferência!
In addition to the configs.imageregistry.operator.openshift.io
and ConfigMap resources, configuration is provided to the Operator by a separate secret resource located within the openshift-image-registry
namespace.
The image-registry-private-configuration-user
secret provides credentials needed for storage access and management. It overrides the default credentials used by the Operator, if default credentials were found.
For S3 on AWS storage the secret is expected to contain two keys:
- REGISTRY_STORAGE_S3_ACCESSKEY
- REGISTRY_STORAGE_S3_SECRETKEY
Procedure
Create an OpenShift Container Platform secret that contains the required keys.
oc create secret generic image-registry-private-configuration-user --from-literal=REGISTRY_STORAGE_S3_ACCESSKEY=myaccesskey --from-literal=REGISTRY_STORAGE_S3_SECRETKEY=mysecretkey --namespace openshift-image-registry
$ oc create secret generic image-registry-private-configuration-user --from-literal=REGISTRY_STORAGE_S3_ACCESSKEY=myaccesskey --from-literal=REGISTRY_STORAGE_S3_SECRETKEY=mysecretkey --namespace openshift-image-registry
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.1.2. Configuring registry storage for AWS with user-provisioned infrastructure Copiar o linkLink copiado para a área de transferência!
During installation, your cloud credentials are sufficient to create an S3 bucket and the Registry Operator will automatically configure storage.
If the Registry Operator cannot create an S3 bucket, and automatically configure storage, you can create an S3 bucket and configure storage with the following procedure.
Prerequisites
- A cluster on AWS with user-provisioned infrastructure.
For S3 on AWS storage the secret is expected to contain two keys:
-
REGISTRY_STORAGE_S3_ACCESSKEY
-
REGISTRY_STORAGE_S3_SECRETKEY
-
Procedure
Use the following procedure if the Registry Operator cannot create an S3 bucket and automatically configure storage.
- Set up a Bucket Lifecycle Policy to abort incomplete multipart uploads that are one day old.
Fill in the storage configuration in
configs.imageregistry.operator.openshift.io/cluster
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
To secure your registry images in AWS, block public access to the S3 bucket.
3.1.3. Image Registry Operator configuration parameters for AWS S3 Copiar o linkLink copiado para a área de transferência!
The following configuration parameters are available for AWS S3 registry storage.
Parameter | Description |
---|---|
| Bucket is the bucket name in which you want to store the registry’s data. It is optional and is generated if not provided. |
| Region is the AWS region in which your bucket exists. It is optional and is set based on the installed AWS Region. |
| RegionEndpoint is the endpoint for S3 compatible storage services. It is optional and defaults based on the Region that is provided. |
| Encrypt specifies whether or not the registry stores the image in encrypted format. It is optional and defaults to false. |
| KeyID is the KMS key ID to use for encryption. It is optional. Encrypt must be true, or this parameter is ignored. |
| CloudFront configures Amazon Cloudfront as the storage middleware in a registry. It is optional. |
3.2. Configuring registry storage for GCP user-provisioned infrastructure Copiar o linkLink copiado para a área de transferência!
3.2.1. Configuring a secret for the Image Registry Operator Copiar o linkLink copiado para a área de transferência!
In addition to the configs.imageregistry.operator.openshift.io
and ConfigMap resources, configuration is provided to the Operator by a separate secret resource located within the openshift-image-registry
namespace.
The image-registry-private-configuration-user
secret provides credentials needed for storage access and management. It overrides the default credentials used by the Operator, if default credentials were found.
For GCS on GCP storage the secret is expected to contain one key whose value is the contents of a credentials file provided by GCP:
- REGISTRY_STORAGE_GCS_KEYFILE
Procedure
Create an OpenShift Container Platform secret that contains the required keys.
oc create secret generic image-registry-private-configuration-user --from-file=REGISTRY_STORAGE_GCS_KEYFILE=<path_to_keyfile> --namespace openshift-image-registry
$ oc create secret generic image-registry-private-configuration-user --from-file=REGISTRY_STORAGE_GCS_KEYFILE=<path_to_keyfile> --namespace openshift-image-registry
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.2.2. Registry storage for GCP with user-provisioned infrastructure Copiar o linkLink copiado para a área de transferência!
You must set up the storage medium manually and configure the settings in the registry CRD.
Prerequisites
- A cluster on GCP with user-provisioned infrastructure.
- To configure registry storage for GCP, you need to provide Registry Operator cloud credentials.
For GCS on GCP storage the secret is expected to contain one key whose value is the contents of a credentials file provided by GCP:
-
REGISTRY_STORAGE_GCS_KEYFILE
-
3.2.3. Image Registry Operator configuration parameters for GCP GCS Copiar o linkLink copiado para a área de transferência!
Procedure
The following configuration parameters are available for GCP GCS registry storage.
Parameter | Description |
---|---|
| Bucket is the bucket name in which you want to store the registry’s data. It is optional and is generated if not provided. |
| Region is the GCS location in which your bucket exists. It is optional and is set based on the installed GCS Region. |
| ProjectID is the Project ID of the GCP project that this bucket should be associated with. It is optional. |
| KeyID is the KMS key ID to use for encryption. It is optional because buckets are encrypted by default on GCP. This allows for the use of a custom encryption key. |
3.3. Configuring registry storage for bare metal Copiar o linkLink copiado para a área de transferência!
3.3.1. Configuring registry storage for bare metal Copiar o linkLink copiado para a área de transferência!
As a cluster administrator, following installation you must configure your registry to use storage.
Prerequisites
- Cluster administrator permissions.
- A cluster on bare metal.
- Provision persistent storage for your cluster, such as Red Hat OpenShift Container Storage. To deploy a private image registry, your storage must provide ReadWriteMany access mode.
- Must have "100Gi" capacity.
Procedure
-
To configure your registry to use storage, change the
spec.storage.pvc
in theconfigs.imageregistry/cluster
resource. Verify you do not have a registry Pod:
oc get pod -n openshift-image-registry
$ oc get pod -n openshift-image-registry
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteIf the storage type is
emptyDIR
, the replica number cannot be greater than1
. If the storage type isNFS
, and you want to scale up the registry Pod by settingreplica>1
you must enable theno_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
# cat /etc/exports /mnt/data *(rw,sync,no_wdelay,no_root_squash,insecure,fsid=0) sh-4.3# exportfs -rv exporting *:/mnt/data
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check the registry configuration:
oc edit configs.imageregistry.operator.openshift.io
$ oc edit configs.imageregistry.operator.openshift.io storage: pvc: claim:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Leave the
claim
field blank to allow the automatic creation of animage-registry-storage
PVC.Check the
clusteroperator
status:oc get clusteroperator image-registry
$ oc get clusteroperator image-registry
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.3.2. Additional resources Copiar o linkLink copiado para a área de transferência!
For more details on configuring registry storage for bare metal, see Recommended configurable storage technology.
3.4. Configuring registry storage for vSphere Copiar o linkLink copiado para a área de transferência!
3.4.1. Configuring registry storage for VMware vSphere Copiar o linkLink copiado para a área de transferência!
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 asNFS
.ImportantvSphere volumes do not support the
ReadWriteMany
access mode. You must use a different storage backend, such asNFS
, to configure the registry storage.- Must have "100Gi" capacity.
Procedure
-
To configure your registry to use storage, change the
spec.storage.pvc
in theconfigs.imageregistry/cluster
resource. Verify you do not have a registry Pod:
oc get pod -n openshift-image-registry
$ oc get pod -n openshift-image-registry
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteIf the storage type is
emptyDIR
, the replica number cannot be greater than1
. If the storage type isNFS
, and you want to scale up the registry Pod by settingreplica>1
you must enable theno_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
# cat /etc/exports /mnt/data *(rw,sync,no_wdelay,no_root_squash,insecure,fsid=0) sh-4.3# exportfs -rv exporting *:/mnt/data
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check the registry configuration:
oc edit configs.imageregistry.operator.openshift.io
$ oc edit configs.imageregistry.operator.openshift.io storage: pvc: claim:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Leave the
claim
field blank to allow the automatic creation of animage-registry-storage
PVC.Optional: Add a new storage class to a PV:
Create the PV:
oc create -f -
$ oc create -f -
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc get pv
$ oc get pv
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the PVC:
oc create -n openshift-image-registry -f -
$ oc create -n openshift-image-registry -f -
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc get pvc -n openshift-image-registry
$ oc get pvc -n openshift-image-registry
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Finally, add the name of your PVC:
oc edit configs.imageregistry.operator.openshift.io -o yaml
$ oc edit configs.imageregistry.operator.openshift.io -o yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow storage: pvc: claim: image-registry-pvc
storage: pvc: claim: image-registry-pvc
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Creating a custom PVC allows you to leave the
claim
field blank for default automatic creation of animage-registry-storage
PVC.
Check the
clusteroperator
status:oc get clusteroperator image-registry
$ oc get clusteroperator image-registry
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.4.2. Additional resources Copiar o linkLink copiado para a área de transferência!
For more details on configuring registry storage for vSphere, see Recommended configurable storage technology.