3.2. 为 Google Cloud 用户置备的基础架构配置 registry
3.2.1. 为 Image Registry Operator 配置一个 secret 复制链接链接已复制到粘贴板!
除了configs.imageregistry.operator.openshift.io及 ConfigMap 资源外,还可以通过openshift-image-registry命名空间中的独立的 secret 资源为 Operator 提供其他配置。
image-registry-private-configuration-user secret 提供了存储访问和管理所需的凭证。如果找到默认凭据,它将覆盖 Operator 使用的默认凭据。
对于 Google Cloud 存储上的 GCS,secret 应该包含以下这个键,其值是 Google Cloud 提供的凭据文件的内容:
-
REGISTRY_STORAGE_GCS_KEYFILE
流程
创建一个包括了所需键的 OpenShift Container Platform secret。
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-registryCopy to Clipboard Copied! Toggle word wrap Toggle overflow
3.2.2. 使用用户置备的基础架构为 Google Cloud 配置 registry 存储 复制链接链接已复制到粘贴板!
如果 Registry Operator 无法创建 Google Cloud 存储桶,您必须手动设置存储介质,并在 registry 自定义资源(CR)中配置设置。
先决条件
- 使用用户置备的基础架构在 Google Cloud 上有一个集群。
- 要为 Google Cloud 配置 registry 存储,您需要提供 Registry Operator 云凭证。
对于 Google Cloud 存储上的 GCS,secret 应该包含以下这个键,其值是 Google Cloud 提供的凭据文件的内容:
-
REGISTRY_STORAGE_GCS_KEYFILE
-
流程
- 设置 对象生命周期管理策略,以中止过去一天的未完成的多部分上传。
在
configs.imageregistry.operator.openshift.io/cluster中中输入存储配置:oc edit configs.imageregistry.operator.openshift.io/cluster
$ oc edit configs.imageregistry.operator.openshift.io/clusterCopy to Clipboard Copied! Toggle word wrap Toggle overflow 配置示例
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
您可以通过设置 公共访问防止来保护使用 Google Cloud Storage 存储桶的 registry 镜像。
3.2.3. Google Cloud GCS 的 Image Registry Operator 配置参数 复制链接链接已复制到粘贴板!
以下配置参数可用于 Google Cloud GCS registry 存储。
| 参数 | 描述 |
|---|---|
|
| 要在其中存储 registry 数据的存储桶名称。它是可选的,如果未提供会自动生成。 |
|
| 存储桶所在的 GCS 的区。它是可选的,并根据已安装的 GCS 区域进行设置。 |
|
| projectID 是此存储桶应与之关联的 Google Cloud 项目的项目 ID。它是可选的。 |
|
| KeyID 是用于加密的 KMS 密钥 ID。它是可选的,因为默认在 Google Cloud 上加密存储桶。这将允许使用一个自定义加密密钥。 |