3.4. 为 Azure 用户置备的基础架构配置 registry

3.4.1. 为 Image Registry Operator 配置一个 secret

除了configs.imageregistry.operator.openshift.io及 ConfigMap 资源外,还可以通过openshift-image-registry命名空间中的独立的 secret 资源为 Operator 提供其他配置。

image-registry-private-configuration-user secret 提供了存储访问和管理所需的凭证。如果找到默认凭据,它将覆盖 Operator 使用的默认凭据。

对于 Azure registry 存储,secret 应该包含这个键,其值是 Azure 提供的凭据文件的内容:

  • REGISTRY_STORAGE_AZURE_ACCOUNTKEY

流程

  • 创建一个包括了所需键的 OpenShift Container Platform secret。

    $ oc create secret generic image-registry-private-configuration-user --from-literal=REGISTRY_STORAGE_AZURE_ACCOUNTKEY=<accountkey> --namespace openshift-image-registry

3.4.2. 为 Azure 配置 registry 存储

在安装过程中,使用您的云凭据就可以创建 Azure Blob Storage,Registry Operator 将会自动配置存储。

先决条件

  • 用户置备的 Azure 中的集群。
  • 要为 Azure 配置 registry 存储,您需要提供 Registry Operator 云凭据。
  • 对于Azure 存储,secret 应该包含以下键:

    • REGISTRY_STORAGE_AZURE_ACCOUNTKEY

流程

  1. 创建一个 Azure 存储容器
  2. configs.imageregistry.operator.openshift.io/cluster中中输入存储配置:

    $ oc edit configs.imageregistry.operator.openshift.io/cluster

    配置示例

    storage:
      azure:
        accountName: <storage-account-name>
        container: <container-name>

3.4.3. 为 Azure 政府配置 registry 存储

在安装过程中,使用您的云凭据就可以创建 Azure Blob Storage,Registry Operator 将会自动配置存储。

先决条件

  • 在一个政府区域中使用用户置备基础架构的 Azure 中的一个集群。
  • 要为 Azure 配置 registry 存储,您需要提供 Registry Operator 云凭据。
  • 对于 Azure 存储,secret 应该包含以下一个键:

    • REGISTRY_STORAGE_AZURE_ACCOUNTKEY

流程

  1. 创建一个 Azure 存储容器
  2. configs.imageregistry.operator.openshift.io/cluster中中输入存储配置:

    $ oc edit configs.imageregistry.operator.openshift.io/cluster

    配置示例

    storage:
      azure:
        accountName: <storage-account-name>
        container: <container-name>
        cloudName: AzureUSGovernmentCloud 1

    1
    CloudName 是 Azure 云环境的名称,可用于使用适当的 Azure API 端点配置 Azure SDK。默认为 AzurePublicCloud。在有足够凭证时,可以将 cloudName 设置为 AzureUSGovernmentCloudAzureChinaCloudAzureGermanCloud