4.11.19. 初始 Operator 配置

在 control plane 初始化后,您必须立即配置一些 Operator 以便它们都可用。

先决条件

  • 您的 control plane 已初始化。

流程

  1. 观察集群组件上线:

    $ watch -n5 oc get clusteroperators

    输出示例

    NAME                                       VERSION AVAILABLE   PROGRESSING   DEGRADED   SINCE
    authentication                             4.7.0   True        False         False      3h56m
    baremetal                                  4.7.0   True        False         False      29h
    cloud-credential                           4.7.0   True        False         False      29h
    cluster-autoscaler                         4.7.0   True        False         False      29h
    config-operator                            4.7.0   True        False         False      6h39m
    console                                    4.7.0   True        False         False      3h59m
    csi-snapshot-controller                    4.7.0   True        False         False      4h12m
    dns                                        4.7.0   True        False         False      4h15m
    etcd                                       4.7.0   True        False         False      29h
    image-registry                             4.7.0   True        False         False      3h59m
    ingress                                    4.7.0   True        False         False      4h30m
    insights                                   4.7.0   True        False         False      29h
    kube-apiserver                             4.7.0   True        False         False      29h
    kube-controller-manager                    4.7.0   True        False         False      29h
    kube-scheduler                             4.7.0   True        False         False      29h
    kube-storage-version-migrator              4.7.0   True        False         False      4h2m
    machine-api                                4.7.0   True        False         False      29h
    machine-approver                           4.7.0   True        False         False      6h34m
    machine-config                             4.7.0   True        False         False      3h56m
    marketplace                                4.7.0   True        False         False      4h2m
    monitoring                                 4.7.0   True        False         False      6h31m
    network                                    4.7.0   True        False         False      29h
    node-tuning                                4.7.0   True        False         False      4h30m
    openshift-apiserver                        4.7.0   True        False         False      3h56m
    openshift-controller-manager               4.7.0   True        False         False      4h36m
    openshift-samples                          4.7.0   True        False         False      4h30m
    operator-lifecycle-manager                 4.7.0   True        False         False      29h
    operator-lifecycle-manager-catalog         4.7.0   True        False         False      29h
    operator-lifecycle-manager-packageserver   4.7.0   True        False         False      3h59m
    service-ca                                 4.7.0   True        False         False      29h
    storage                                    4.7.0   True        False         False      4h30m

  2. 配置不可用的 Operator。

4.11.19.1. 镜像 registry 存储配置

Amazon Web Services 提供默认存储,这意味着 Image Registry Operator 在安装后可用。但是,如果 Registry Operator 无法创建 S3 存储桶并自动配置存储,您需要手工配置 registry 存储。

示配置生产集群所需的持久性卷的说明。如果适用,显示有关将空目录配置为存储位置的说明,该位置只可用于非生产集群。

另外还提供了在升级过程中使用 Recreate rollout 策略来允许镜像 registry 使用块存储类型的说明。

您可以在 AWS 中为用户置备的基础架构配置 registry 存储,以将 OpenShift Container Platform 部署到隐藏的区域。如需更多信息,请参阅为 AWS 用户置备的基础架构配置 registry

4.11.19.1.1. 为使用用户置备的基础架构的 AWS 配置 registry 存储

在安装过程中,使用您的云凭据就可以创建一个 Amazon S3 存储桶,Registry Operator 将会自动配置存储。

如果 Registry Operator 无法创建 S3 存储桶或自动配置存储,您可以按照以下流程创建 S3 存储桶并配置存储。

先决条件

  • 在带有用户置备的基础架构的 AWS 上有一个集群。
  • 对于 Amazon S3 存储,secret 应该包含以下两个键:

    • REGISTRY_STORAGE_S3_ACCESSKEY
    • REGISTRY_STORAGE_S3_SECRETKEY

流程

如果 Registry Operator 无法创建 S3 存储桶并自动配置存储,请进行以下操作。

  1. 设置一个 Bucket Lifecycle Policy用来终止已有一天之久的未完成的分段上传操作。
  2. configs.imageregistry.operator.openshift.io/cluster中中输入存储配置:

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

    配置示例

    storage:
      s3:
        bucket: <bucket-name>
        region: <region-name>

警告

为了保护 AWS 中 registry 镜像的安全,阻止对 S3 存储桶的公共访问

4.11.19.1.2. 在非生产集群中配置镜像 registry 存储

您必须为 Image Registry Operator 配置存储。对于非生产集群,您可以将镜像 registry 设置为空目录。如果您这样做,重启 registry 后会丢失所有镜像。

流程

  • 将镜像 registry 存储设置为空目录:

    $ oc patch configs.imageregistry.operator.openshift.io cluster --type merge --patch '{"spec":{"storage":{"emptyDir":{}}}}'
    警告

    仅可为非生产集群配置这个选项。

    如果在 Image Registry Operator 初始化其组件前运行此命令,oc patch 命令会失败并显示以下错误:

    Error from server (NotFound): configs.imageregistry.operator.openshift.io "cluster" not found

    等待几分钟,然后再次运行该命令。