1.7. 使用 Deployment Manager 模板在 GCP 上安装集群

在 OpenShift Container Platform 版本 4.3 中,您可以使用您提供的基础架构在 Google Cloud Platform (GCP) 上安装集群。

此处概述了进行用户提供基础架构安装的步骤。提供的几个 Deployment Manager 模板可协助完成这些步骤,也可帮助您自行建模。您也可以自由选择通过其他方法创建所需的资源;模板仅作示例之用。

1.7.1. 先决条件

1.7.2. 证书签名请求管理

在使用您置备的基础架构时,集群只能有限地访问自动机器管理,因此您必须提供一种在安装后批准集群证书签名请求 (CSR) 的机制。kube-controller-manager 只能批准 kubelet 客户端 CSR。machine-approver 无法保证使用 kubelet 凭证请求的提供证书的有效性,因为它不能确认是正确的机器发出了该请求。您必须决定并实施一种方法,以验证 kubelet 提供证书请求的有效性并进行批准。

1.7.3. 配置 GCP 项目

在安装 OpenShift Container Platform 之前,您必须配置 Google Cloud Platform (GCP) 项目来托管它。

1.7.3.1. 创建一个 GCP 项目

为了安装 OpenShift Container Platform,您必须在您的 Google Cloud Platform (GCP) 账户中创建一个项目来托管它。

流程

  • 创建一个项目来托管您的 OpenShift Container Platform 集群。请参阅 GCP 文档中的创建和管理项目

1.7.3.2. 在 GCP 中启用 API 服务

Google Cloud Platform (GCP) 项目需要访问一些 API 服务来完成 OpenShift Container Platform 安装。

先决条件

  • 创建了用于托管集群的项目。

流程

  • 在托管集群的项目中启用如下所需的 API 服务。请参阅 GCP 文档中的启用服务

    表 1.17. 所需的 API 服务

    API 服务控制台服务名称

    Cloud Deployment Manager V2 API

    deploymentmanager.googleapis.com

    compute Engine API

    compute.googleapis.com

    Google Cloud API

    cloudapis.googleapis.com

    Cloud Resource Manager API

    cloudresourcemanager.googleapis.com

    Google DNS API

    dns.googleapis.com

    IAM Service Account Credentials API

    iamcredentials.googleapis.com

    Identity and Access Management (IAM) API

    iam.googleapis.com

    Service Management API

    servicemanagement.googleapis.com

    Service Usage API

    serviceusage.googleapis.com

    Google Cloud Storage JSON API

    storage-api.googleapis.com

    Cloud Storage

    storage-component.googleapis.com

1.7.3.3. 为 GCP 配置 DNS

要安装 OpenShift Container Platform,您使用的 Google Cloud Platform (GCP) 帐户必须在托管 OpenShift Container Platform 集群的同一项目中有一个专用的公共托管区。此区域必须对域具有权威。DNS 服务为集群外部连接提供集群 DNS 解析和名称查询。

流程

  1. 标识您的域或子域,以及注册商(registrar)。您可以转移现有的域和注册商,或通过 GCP 或其他来源获取新的域和注册商。

    注意

    如果您购买新域,则需要时间来传播相关的 DNS 更改。有关通过 Google 购买域的更多信息,请参阅 Google Domains

  2. 在 GCP 项目中为您的域或子域创建一个公共托管区。请参阅 GCP 文档中的创建公共区

    使用合适的根域(如 openshiftcorp.com)或子域(如 clusters.openshiftcorp.com)。

  3. 从托管区记录中提取新的权威名称服务器。请参阅 GCP 文档中的查找您的云 DNS 名称服务器

    您通常有四个名称服务器。

  4. 更新域所用名称服务器的注册商记录。例如,如果您将域注册到了 Google Domains,请参阅 Google Domains 帮助中的以下主题:如何切换到自定义名称服务器
  5. 如果您将根域迁移到 Google Cloud DNS,请迁移您的 DNS 记录。请参阅 GCP 文档中的 Migrating to Cloud DNS
  6. 如果您使用子域,请按照您公司的流程将其委派记录添加到父域。这个过程可能包括对您公司的 IT 部门或控制您公司的根域和 DNS 服务的部门提出请求。

1.7.3.4. GCP 帐户限值

OpenShift Container Platform 集群使用诸多 Google Cloud Platform (GCP) 组件,默认的配额不会影响您安装默认 OpenShift Container Platform 集群的能力。

默认集群中包含三台计算机器和三台 control plane 机器,使用了以下资源。请注意,一些资源只在 bootstrap 过程中需要,会在集群部署后删除。

表 1.18. 默认集群中使用的 GCP 资源

服务组件位置所需的资源总数bootstrap 后删除的资源

服务帐户

IAM

全局

5

0

防火墙规则

网络

全局

11

1

转发规则

Compute

全局

2

0

健康检查

Compute

全局

2

0

镜像

Compute

全局

1

0

网络

网络

全局

1

0

路由器

网络

全局

1

0

Routes

网络

全局

2

0

子网

Compute

全局

2

0

目标池

网络

全局

2

0

注意

如果在安装过程中存在任何配额不足的情况,安装程序会显示一个错误信息,包括超过哪个配额,以及相关的区域。

请考虑您的集群的实际大小、预定的集群增长以及来自与您的帐户关联的其它集群的使用情况。CPU 、静态 IP 地址和持久性磁盘 SSD (Storage) 配额是最可能不足的。

如果您计划在以下区域之一部署集群,您将超过最大存储配额,并可能会超过 CPU 配额限制:

  • asia-east2
  • asia-northeast2
  • asia-south1
  • domain-southeast1
  • europe-north1
  • europe-west2
  • europe-west3
  • europe-west6
  • northamerica-northeast1
  • southamerica-east1
  • us-west2

您可以从 GCP 控制台增加资源配额,但可能需要提交一个支持问题单。务必提前规划集群大小,以便在安装 OpenShift Container Platform 集群前有足够的时间来等待支持问题单被处理。:!template:

1.7.3.5. 在 GCP 中创建服务帐户

OpenShift Container Platform 需要一个 Google Cloud Platform (GCP) 服务帐户,用于访问 Google API 中数据的验证和授权。如果您没有包含项目中所需角色的现有 IAM 服务帐户,您必须创建一个。

先决条件

  • 创建了用于托管集群的项目。

流程

  1. 在用于托管 OpenShift Container Platform 集群的项目中,创建一个新服务帐户。请参阅 GCP 文档中的创建服务账户
  2. 为服务帐户授予适当的权限。您可以逐一授予权限,也可以为其分配 Owner 角色。请参阅将角色授予特定资源的服务帐户

    注意

    获得所需权限最简单的方法是把服务帐户设置为项目的拥有者(Owner),这意味着该服务帐户对项目有完全的控制权。您必须考虑这样设定所带来的的风险是否可以接受。

  3. 以 JSON 格式创建服务帐户密钥。请参阅 GCP 文档中的创建服务帐户密钥

    创建集群时需要该服务帐户密钥。

1.7.3.5.1. 所需的 GCP 权限

如果将 Owner 角色附加到您创建的服务帐户,您向该服务帐户授予所有的权限,包括安装 OpenShift Container Platform 所需的权限。要部署 OpenShift Container Platform 集群,服务帐户需要以下权限:如果您将集群部署到现有的 VPC 中,则服务帐户不需要某些网络权限,如下表所示:

安装程序所需的角色

  • Compute Admin
  • Security Admin
  • Service Account Admin
  • Service Account User
  • Storage Admin

安装过程中创建网络资源所需的角色

  • DNS Administrator

用户置备的 GCP 基础架构所需的角色

  • Deployment Manager Editor
  • Service Account Key Admin

可选角色

若要使集群为其 Operator 创建新的有限凭证,请添加以下角色:

  • Service Account Key Admin

以下角色将应用到 control plane 或计算机器使用的服务帐户:

表 1.19. GCP 服务帐户权限

帐户角色

Control Plane

roles/compute.instanceAdmin

roles/compute.networkAdmin

roles/compute.securityAdmin

roles/storage.admin

roles/iam.serviceAccountUser

Compute

roles/compute.viewer

roles/storage.admin

1.7.3.6. 支持的 GCP 区域

您可以将 OpenShift Container Platform 集群部署到下列 Google Cloud Platform (GCP) 区域:

  • asia-east1(台湾彰化县)
  • asia-east2(香港)
  • asia-northeast1 (日本东京)
  • asia-northeast2(日本大阪)
  • asia-south1(印度孟买)
  • asia-southeast1(新加坡裕廊西)
  • australia-southeast1(澳大利亚悉尼)
  • europe-north1(芬兰哈米纳)
  • europe-west1(比利时圣吉斯兰)
  • europe-west2(英国伦敦)
  • europe-west3(德国法兰克福)
  • europe-west4(荷兰埃姆斯哈文)
  • europe-west6(瑞士苏黎世)
  • northamerica-northeast1(加拿大魁北克蒙特利尔)
  • southamerica-east1(巴西圣保罗)
  • us-central1(美国爱荷华州康瑟尔布拉夫斯)
  • us-east1(美国南卡罗来纳州蒙克斯科纳)
  • us-east4(美国北弗吉尼亚州阿什伯恩)
  • us-west1(美国俄勒冈州达拉斯)
  • us-west2(美国加利福尼亚州洛杉矶)

1.7.3.7. 为 GCP 安装和配置 CLI 工具

要使用用户置备的基础架构在 Google Cloud Platform (GCP) 上安装 OpenShift Container Platform,您必须为 GCP 安装和配置 CLI 工具。

先决条件

  • 创建了用于托管集群的项目。
  • 您创建了服务帐户,并授予其所需的权限。

流程

  1. $PATH 中安装以下二进制文件:

    • gcloud
    • gsutil

    请参阅 GCP 文档中的安装最新 Cloud SDK 版本

  2. 使用 gcloud 工具及您配置的服务帐户进行身份验证。

1.7.4. 为 GCP 创建安装文件

要使用用户置备的基础架构在 Google Cloud Platform (GCP) 上安装 OpenShift Container Platform,您必须生成并修改安装程序部署集群所需的文件,以便集群只创建要使用的机器。您要生成并自定义 install-config.yaml 文件、Kubernetes 清单和 Ignition 配置文件。

1.7.4.1. 创建安装配置文件

您可以自定义 Google Cloud Platform (GCP) 上的 OpenShift Container Platform 安装。

先决条件

  • 获取 OpenShift Container Platform 安装程序以及集群的 pull secret。

流程

  1. 创建 install-config.yaml 文件。

    1. 运行以下命令:

      $ ./openshift-install create install-config --dir=<installation_directory> 1
      1
      对于 <installation_directory>,请指定用于保存安装程序所创建的文件的目录名称。
      重要

      指定一个空目录。一些安装信息,如 bootstrap X.509 证书,有较短的过期间隔,因此不要重复使用安装目录。如果要重复使用另一个集群安装中的个别文件,可以将其复制到您的目录中。但是,一些安装数据的文件名可能会在发行版本之间有所改变。从 OpenShift Container Platform 老版本中复制安装文件时要格外小心。

    2. 在提示符处,提供您的云的配置详情:

      1. 可选:选择用来访问集群机器的 SSH 密钥。

        注意

        对于您要在其上执行安装调试或灾难恢复的生产环境 OpenShift Container Platform 集群,请指定 ssh-agent 进程使用的 SSH 密钥。

      2. 选择 gcp 作为目标平台。
      3. 如果您没有为计算机上的 GCP 帐户配置服务帐户密钥,则必须从 GCP 获取,并粘贴文件的内容或输入文件的绝对路径。
      4. 选择要在其中置备集群的项目 ID。默认值由您配置的服务帐户指定。
      5. 选择要在其中部署集群的区域。
      6. 选择集群要部署到的基域。基域与您为集群创建的公共 DNS 区对应。
      7. 为集群输入一个描述性名称。如果您提供的名称超过 6 个字符,只有前 6 个字符会用在从集群名称生成的基础架构 ID 中。
      8. 粘贴从 Red Hat OpenShift Cluster Manager 站点的 Pull Secret 页面中获取的 pull secret。
    3. 可选:如果您不希望集群置备计算机器,请通过编辑 install-config.yaml 文件将 compute 池的 replicas 设置为 0 来清空计算池。

      compute:
      - hyperthreading: Enabled
        name: worker
        platform: {}
        replicas: 0 1
      1
      设置为 0
  2. 修改 install-config.yaml 文件。您可以在安装配置参数部分中找到有关可用参数的更多信息。
  3. 备份 install-config.yaml 文件,以便用于安装多个集群。

    重要

    install-config.yaml 文件会在安装过程中消耗掉。如果要重复使用此文件,必须现在备份。

1.7.4.2. 在安装过程中配置集群范围代理

生产环境可能会拒绝直接访问互联网,而是提供 HTTP 或 HTTPS 代理。您可以通过在 install-config.yaml 文件中配置代理设置,将新的 OpenShift Container Platform 集群配置为使用代理。

先决条件

  • 现有的 install-config.yaml 文件。
  • 查看集群需要访问的站点,并决定是否需要绕过代理。默认情况下代理所有集群出口流量,包括对托管云供应商 API 的调用。若有需要,将站点添加到 Proxy 对象的 spec.noProxy 字段来绕过代理服务器。

    注意

    Proxy 对象的 status.noProxy 字段默认填充实例元数据端点 (169.254.169.254),以及您的安装配置中 networking.machineCIDRnetworking.clusterNetwork.cidrnetworking.serviceNetwork[] 字段的值。

流程

  1. 编辑 install-config.yaml 文件并添加代理设置。例如:

    apiVersion: v1
    baseDomain: my.domain.com
    proxy:
      httpProxy: http://<username>:<pswd>@<ip>:<port> 1
      httpsProxy: http://<username>:<pswd>@<ip>:<port> 2
      noProxy: example.com 3
    additionalTrustBundle: | 4
        -----BEGIN CERTIFICATE-----
        <MY_TRUSTED_CA_CERT>
        -----END CERTIFICATE-----
    ...
    1
    用于创建集群外 HTTP 连接的代理 URL。URL 必须是 http。如果您使用不要求额外代理配置但需要额外 CA 的 MITM 透明代理网络,则不得指定 httpProxy 值。
    2
    用于创建集群外 HTTPS 连接的代理 URL。如果未指定此字段,httpProxy 会同时用于 HTTP 和 HTTPS 连接。如果您使用不要求额外代理配置但需要额外 CA 的 MITM 透明代理网络,则不得指定 httpsProxy 值。
    3
    要排除代理的目标域名、域、IP 地址或其他网络 CIDR 的逗号分隔列表。域之前加上前缀 . 可包含该域的所有子域。使用 * 可对所有目的地绕过所有代理。
    4
    如果提供,安装程序会在 openshift-config 命名空间中生成名为 user-ca-bundle 的 ConfigMap,其包含代理 HTTPS 连接所需的一个或多个额外 CA 证书。然后,Cluster Network Operator 会创建 trusted-ca-bundle ConfigMap,将这些内容与 Red Hat Enterprise Linux CoreOS (RHCOS) 信任捆绑包合并,Proxy 对象的 trustedCA 字段中也会引用此 ConfigMap。additionalTrustBundle 字段是必需的,除非代理的身份证书由来自 RHCOS 信任捆绑包的颁发机构签名。如果您使用不要求额外代理配置但需要额外 CA 的 MITM 透明代理网络,您必须提供 MITM CA 证书。
    注意

    安装程序不支持代理的 readinessEndpoints 字段。

  2. 保存该文件,并在安装 OpenShift Container Platform 时引用。

安装程序会创建一个名为 cluster 的集群范围代理,该代理使用提供的 install-config.yaml 文件中的代理设置。如果没有提供代理设置,仍然会创建 cluster Proxy 对象,但它会有一个零 spec

注意

只支持名为 cluster 的 Proxy 对象,且无法创建额外的代理。

1.7.4.3. 创建 Kubernetes 清单和 Ignition 配置文件

由于您必须修改一些集群定义文件并要手动启动集群机器,因此您必须生成 Kubernetes 清单和 Ignition 配置文件,集群需要这两项来创建其机器。

重要

安装程序生成的 Ignition 配置文件中所含的证书会在 24 小时后过期。您必须完成集群安装,并使集群以非降级状态运行 24 小时,以确保完成第一次证书轮转。

先决条件

  • 获取 OpenShift Container Platform 安装程序。
  • 创建 install-config.yaml 安装配置文件。

流程

  1. 为集群生成 Kubernetes 清单:

    $ ./openshift-install create manifests --dir=<installation_directory> 1
    
    INFO Consuming Install Config from target directory
    WARNING Making control-plane schedulable by setting MastersSchedulable to true for Scheduler cluster settings
    1
    对于 <installation_directory>,请指定含有您创建的 install-config.yaml 文件的安装目录。

    由于您稍后会在安装过程中自行创建计算机器,因此可以忽略这个警告。

  2. 删除定义 control plane 机器的 Kubernetes 清单文件:

    $ rm -f <installation_directory>/openshift/99_openshift-cluster-api_master-machines-*.yaml

    通过删除这些文件,您可以防止集群自动生成 control plane 机器。

  3. 可选:如果您不希望集群置备计算机器,请删除定义 worker 机器的 Kubernetes 清单文件:

    $ rm -f <installation_directory>/openshift/99_openshift-cluster-api_worker-machineset-*.yaml

    由于您要自行创建并管理 worker 机器,因此不需要初始化这些机器。

  4. 修改 <installation_directory>/manifests/cluster-scheduler-02-config.yml Kubernetes 清单文件,以防止在 control plane 机器上调度 Pod:

    1. 打开 <installation_directory>/manifests/cluster-scheduler-02-config.yml 文件。
    2. 找到 mastersSchedulable 参数,并将其值设为 False
    3. 保存并退出文件。
    注意

    目前,由于 Kubernetes 限制,入口负载均衡器将无法访问在 control plane 机器上运行的路由器 Pod。以后的 OpenShift Container Platform 次要版本中可能不需要这一步骤。

  5. 可选:如果您不希望 Ingress Operator 代表您创建 DNS 记录,请删除 <installation_directory>/manifests/cluster-dns-02-config.yml DNS 配置文件中的 privateZonepublicZone 部分:

    apiVersion: config.openshift.io/v1
    kind: DNS
    metadata:
      creationTimestamp: null
      name: cluster
    spec:
      baseDomain: example.openshift.com
      privateZone: 1
        id: mycluster-100419-private-zone
      publicZone: 2
        id: example.openshift.com
    status: {}
    1 2
    彻底删除这些部分。

    如果您这样做,后续步骤中必须手动添加入口 DNS 记录。

  6. 获取 Ignition 配置文件:

    $ ./openshift-install create ignition-configs --dir=<installation_directory> 1
    1
    对于 <installation_directory>,请指定相同的安装目录。

    该目录中将生成以下文件:

    .
    ├── auth
    │   ├── kubeadmin-password
    │   └── kubeconfig
    ├── bootstrap.ign
    ├── master.ign
    ├── metadata.json
    └── worker.ign

1.7.5. 导出常用变量

1.7.5.1. 提取基础架构名称

Ignition 配置包含一个唯一集群标识符,您可以使用它在 Google Cloud Platform (GCP) 中唯一地标识您的集群。提供的 Deployment Manager 模板包含对此基础架构名称的引用,因此您必须提取它。

先决条件

  • 获取 OpenShift Container Platform 安装程序以及集群的 pull secret。
  • 为集群生成 Ignition 配置文件。
  • 安装 jq 软件包。

流程

  • 要从 Ignition 配置文件元数据中提取和查看基础架构名称,请运行以下命令:

    $ jq -r .infraID /<installation_directory>/metadata.json 1
    openshift-vw9j6 2
    1
    对于 <installation_directory>,请指定安装文件保存到的目录的路径。
    2
    此命令的输出是您的集群名称和随机字符串。

1.7.5.2. 为 Deployment Manager 模板导出常用变量

您必须导出与提供的 Deployment Manager 模板搭配使用的一组常用变量,它们有助于在 Google Cloud Platform (GCP) 上完成用户提供基础架构安装。

注意

特定的 Deployment Manager 模板可能还需要其他导出变量,这些变量在相关的程序中详细介绍。

先决条件

  • 获取 OpenShift Container Platform 安装程序以及集群的 pull secret。
  • 为集群生成 Ignition 配置文件。
  • 安装 jq 软件包。

流程

  • 导出由提供的 Deployment Manager 模板使用的以下常用变量:

    $ export BASE_DOMAIN='<base_domain>'
    $ export BASE_DOMAIN_ZONE_NAME='<base_domain_zone_name>'
    $ export NETWORK_CIDR='10.0.0.0/16'
    $ export MASTER_SUBNET_CIDR='10.0.0.0/19'
    $ export WORKER_SUBNET_CIDR='10.0.32.0/19'
    
    $ export KUBECONFIG=<installation_directory>/auth/kubeconfig 1
    $ export CLUSTER_NAME=`jq -r .clusterName <installation_directory>/metadata.json`
    $ export INFRA_ID=`jq -r .infraID <installation_directory>/metadata.json`
    $ export PROJECT_NAME=`jq -r .gcp.projectID <installation_directory>/metadata.json`
    $ export REGION=`jq -r .gcp.region <installation_directory>/metadata.json`
    1
    对于 <installation_directory>,请指定安装文件保存到的目录的路径。

1.7.6. 在 GCP 中创建 VPC

您必须在 Google Cloud Platform (GCP) 中创建一个 VPC,供您的 OpenShift Container Platform 集群使用。您可以自定义 VPC 来满足您的要求。创建 VPC 的一种方法是修改提供的 Deployment Manager 模板。

注意

如果不使用提供的 Deployment Manager 模板来创建 GCP 基础架构,您必须检查提供的信息并手动创建基础架构。如果集群没有正确初始化,您可能需要联系红帽支持并提供您的安装日志。

先决条件

  • 配置 GCP 帐户。
  • 为集群生成 Ignition 配置文件。

流程

  1. 复制 VPC 的 Deployment Manager 模板一节中的模板,并将它以 01_vpc.py 形式保存到计算机上。此模板描述了集群所需的 VPC。
  2. 创建 01_vpc.yaml 资源定义文件:

    $ cat <<EOF >01_vpc.yaml
    imports:
    - path: 01_vpc.py
    
    resources:
    - name: cluster-vpc
      type: 01_vpc.py
      properties:
        infra_id: '${INFRA_ID}' 1
        region: '${REGION}' 2
        master_subnet_cidr: '${MASTER_SUBNET_CIDR}' 3
        worker_subnet_cidr: '${WORKER_SUBNET_CIDR}' 4
    EOF
    1
    infra_id 是来自于提取步骤的 INFRA_ID 基础架构名称。
    2
    region 是集群要部署到的区域,如 us-east1
    3
    master_subnet_cidr 是 master 子网的 CIDR,如 10.0.0.0/19
    4
    worker_subnet_cidr 是 worker 子网的 CIDR,如 10.0.32.0/19
  3. 使用 gcloud CLI 创建部署:

    $ gcloud deployment-manager deployments create ${INFRA_ID}-vpc --config 01_vpc.yaml

1.7.6.1. VPC 的 Deployment Manager 模板

您可以使用以下 Deployment Manager 模板来部署 OpenShift Container Platform 集群所需的 VPC:

01_VPC.py Deployment Manager 模板

def GenerateConfig(context):

    resources = [{
        'name': context.properties['infra_id'] + '-network',
        'type': 'compute.v1.network',
        'properties': {
            'region': context.properties['region'],
            'autoCreateSubnetworks': False
        }
    }, {
        'name': context.properties['infra_id'] + '-master-subnet',
        'type': 'compute.v1.subnetwork',
        'properties': {
            'region': context.properties['region'],
            'network': '$(ref.' + context.properties['infra_id'] + '-network.selfLink)',
            'ipCidrRange': context.properties['master_subnet_cidr']
        }
    }, {
        'name': context.properties['infra_id'] + '-worker-subnet',
        'type': 'compute.v1.subnetwork',
        'properties': {
            'region': context.properties['region'],
            'network': '$(ref.' + context.properties['infra_id'] + '-network.selfLink)',
            'ipCidrRange': context.properties['worker_subnet_cidr']
        }
    }, {
        'name': context.properties['infra_id'] + '-master-nat-ip',
        'type': 'compute.v1.address',
        'properties': {
            'region': context.properties['region']
        }
    }, {
        'name': context.properties['infra_id'] + '-worker-nat-ip',
        'type': 'compute.v1.address',
        'properties': {
            'region': context.properties['region']
        }
    }, {
        'name': context.properties['infra_id'] + '-router',
        'type': 'compute.v1.router',
        'properties': {
            'region': context.properties['region'],
            'network': '$(ref.' + context.properties['infra_id'] + '-network.selfLink)',
            'nats': [{
                'name': context.properties['infra_id'] + '-nat-master',
                'natIpAllocateOption': 'MANUAL_ONLY',
                'natIps': ['$(ref.' + context.properties['infra_id'] + '-master-nat-ip.selfLink)'],
                'minPortsPerVm': 7168,
                'sourceSubnetworkIpRangesToNat': 'LIST_OF_SUBNETWORKS',
                'subnetworks': [{
                    'name': '$(ref.' + context.properties['infra_id'] + '-master-subnet.selfLink)',
                    'sourceIpRangesToNat': ['ALL_IP_RANGES']
                }]
            }, {
                'name': context.properties['infra_id'] + '-nat-worker',
                'natIpAllocateOption': 'MANUAL_ONLY',
                'natIps': ['$(ref.' + context.properties['infra_id'] + '-worker-nat-ip.selfLink)'],
                'minPortsPerVm': 128,
                'sourceSubnetworkIpRangesToNat': 'LIST_OF_SUBNETWORKS',
                'subnetworks': [{
                    'name': '$(ref.' + context.properties['infra_id'] + '-worker-subnet.selfLink)',
                    'sourceIpRangesToNat': ['ALL_IP_RANGES']
                }]
            }]
        }
    }]

    return {'resources': resources}

1.7.7. 在 GCP 中创建网络和负载均衡组件

您必须在 Google Cloud Platform (GCP) 中配置网络和负载均衡,供您的 OpenShift Container Platform 集群使用。创建这些组件的一种方法是修改提供的 Deployment Manager 模板。

注意

如果不使用提供的 Deployment Manager 模板来创建 GCP 基础架构,您必须检查提供的信息并手动创建基础架构。如果集群没有正确初始化,您可能需要联系红帽支持并提供您的安装日志。

先决条件

  • 配置 GCP 帐户。
  • 为集群生成 Ignition 配置文件。
  • 在 GCP 中创建和配置 VPC 及相关子网。

流程

  1. 复制网络和负载均衡器的 Deployment Manager 模板一节中的模板,并将它以 02_infra.py 形式保存到计算机上。此模板描述了集群所需的网络和负载均衡对象。
  2. 导出资源定义所需的以下变量:

    $ export CLUSTER_NETWORK=`gcloud compute networks describe ${INFRA_ID}-network --format json | jq -r .selfLink`
  3. 创建 02_infra.yaml 资源定义文件:

    $ cat <<EOF >02_infra.yaml
    imports:
    - path: 02_infra.py
    
    resources:
    - name: cluster-infra
      type: 02_infra.py
      properties:
        infra_id: '${INFRA_ID}' 1
        region: '${REGION}' 2
    
        cluster_domain: '${CLUSTER_NAME}.${BASE_DOMAIN}' 3
        cluster_network: '${CLUSTER_NETWORK}' 4
    EOF
    1
    infra_id 是来自于提取步骤的 INFRA_ID 基础架构名称。
    2
    region 是集群要部署到的区域,如 us-east1
    3
    cluster_domain 是集群的域,如 openshift.example.com
    4
    cluster_network 是集群网络的 selfLink URL。
  4. 使用 gcloud CLI 创建部署:

    $ gcloud deployment-manager deployments create ${INFRA_ID}-infra --config 02_infra.yaml
  5. 由于 Deployment Manager 的限制,模板不会创建 DNS 条目,因此您必须手动创建它们:

    1. 导出以下变量:

      $ export CLUSTER_IP=`gcloud compute addresses describe ${INFRA_ID}-cluster-public-ip --region=${REGION} --format json | jq -r .address`
    2. 添加外部 DNS 条目:

      $ if [ -f transaction.yaml ]; then rm transaction.yaml; fi
      $ gcloud dns record-sets transaction start --zone ${BASE_DOMAIN_ZONE_NAME}
      $ gcloud dns record-sets transaction add ${CLUSTER_IP} --name api.${CLUSTER_NAME}.${BASE_DOMAIN}. --ttl 60 --type A --zone ${BASE_DOMAIN_ZONE_NAME}
      $ gcloud dns record-sets transaction execute --zone ${BASE_DOMAIN_ZONE_NAME}
    3. 添加内部 DNS 条目:

      $ if [ -f transaction.yaml ]; then rm transaction.yaml; fi
      $ gcloud dns record-sets transaction start --zone ${INFRA_ID}-private-zone
      $ gcloud dns record-sets transaction add ${CLUSTER_IP} --name api.${CLUSTER_NAME}.${BASE_DOMAIN}. --ttl 60 --type A --zone ${INFRA_ID}-private-zone
      $ gcloud dns record-sets transaction add ${CLUSTER_IP} --name api-int.${CLUSTER_NAME}.${BASE_DOMAIN}. --ttl 60 --type A --zone ${INFRA_ID}-private-zone
      $ gcloud dns record-sets transaction execute --zone ${INFRA_ID}-private-zone

1.7.7.1. 网络和负载均衡器的 Deployment Manager 模板

您可以使用以下 Deployment Manager 模板来部署 OpenShift Container Platform 集群所需的网络对象和负载均衡器:

02_infra.py Deployment Manager 模板

def GenerateConfig(context):

    resources = [{
        'name': context.properties['infra_id'] + '-cluster-public-ip',
        'type': 'compute.v1.address',
        'properties': {
            'region': context.properties['region']
        }
    }, {
        'name': context.properties['infra_id'] + '-api-http-health-check',
        'type': 'compute.v1.httpHealthCheck',
        'properties': {
            'port': 6080,
            'requestPath': '/readyz'
        }
    }, {
        'name': context.properties['infra_id'] + '-api-target-pool',
        'type': 'compute.v1.targetPool',
        'properties': {
            'region': context.properties['region'],
            'healthChecks': ['$(ref.' + context.properties['infra_id'] + '-api-http-health-check.selfLink)'],
            'instances': []
        }
    }, {
        'name': context.properties['infra_id'] + '-api-forwarding-rule',
        'type': 'compute.v1.forwardingRule',
        'properties': {
            'region': context.properties['region'],
            'IPAddress': '$(ref.' + context.properties['infra_id'] + '-cluster-public-ip.selfLink)',
            'target': '$(ref.' + context.properties['infra_id'] + '-api-target-pool.selfLink)',
            'portRange': '6443'
        }
    }, {
        'name': context.properties['infra_id'] + '-ign-http-health-check',
        'type': 'compute.v1.httpHealthCheck',
        'properties': {
            'port': 22624,
            'requestPath': '/healthz'
        }
    }, {
        'name': context.properties['infra_id'] + '-ign-target-pool',
        'type': 'compute.v1.targetPool',
        'properties': {
            'region': context.properties['region'],
            'healthChecks': ['$(ref.' + context.properties['infra_id'] + '-ign-http-health-check.selfLink)'],
            'instances': []
        }
    }, {
        'name': context.properties['infra_id'] + '-ign-forwarding-rule',
        'type': 'compute.v1.forwardingRule',
        'properties': {
            'region': context.properties['region'],
            'IPAddress': '$(ref.' + context.properties['infra_id'] + '-cluster-public-ip.selfLink)',
            'target': '$(ref.' + context.properties['infra_id'] + '-ign-target-pool.selfLink)',
            'portRange': '22623'
        }
    }, {
        'name': context.properties['infra_id'] + '-private-zone',
        'type': 'dns.v1.managedZone',
        'properties': {
            'description': '',
            'dnsName': context.properties['cluster_domain'] + '.',
            'visibility': 'private',
            'privateVisibilityConfig': {
                'networks': [{
                    'networkUrl': context.properties['cluster_network']
                }]
            }
        }
    }]

    return {'resources': resources}

1.7.8. 在 GCP 中创建防火墙规则和 IAM 角色

您必须在 Google Cloud Platform (GCP) 中创建安全组和角色,供您的 OpenShift Container Platform 集群使用。创建这些组件的一种方法是修改提供的 Deployment Manager 模板。

注意

如果不使用提供的 Deployment Manager 模板来创建 GCP 基础架构,您必须检查提供的信息并手动创建基础架构。如果集群没有正确初始化,您可能需要联系红帽支持并提供您的安装日志。

先决条件

  • 配置 GCP 帐户。
  • 为集群生成 Ignition 配置文件。
  • 在 GCP 中创建和配置 VPC 及相关子网。

流程

  1. 复制防火墙规则和 IAM 角色的 Deployment Manager 模板一节中的模板,并将它以 03_security.py 形式保存到计算机上。此模板描述了集群所需的安全组和角色。
  2. 导出资源定义所需的以下变量:

    $ export MASTER_NAT_IP=`gcloud compute addresses describe ${INFRA_ID}-master-nat-ip --region ${REGION} --format json | jq -r .address`
    $ export WORKER_NAT_IP=`gcloud compute addresses describe ${INFRA_ID}-worker-nat-ip --region ${REGION} --format json | jq -r .address`
  3. 创建 03_security.yaml 资源定义文件:

    $ cat <<EOF >03_security.yaml
    imports:
    - path: 03_security.py
    
    resources:
    - name: cluster-security
      type: 03_security.py
      properties:
        infra_id: '${INFRA_ID}' 1
        region: '${REGION}' 2
    
        cluster_network: '${CLUSTER_NETWORK}' 3
        network_cidr: '${NETWORK_CIDR}' 4
        master_nat_ip: '${MASTER_NAT_IP}' 5
        worker_nat_ip: '${WORKER_NAT_IP}' 6
    EOF
    1
    infra_id 是来自于提取步骤的 INFRA_ID 基础架构名称。
    2
    region 是集群要部署到的区域,如 us-east1
    3
    cluster_network 是集群网络的 selfLink URL。
    4
    network_cidr 是 VPC 网络的 CIDR,如 10.0.0.0/16
    5
    master_nat_ip 是 master NAT 的 IP 地址,如 34.94.100.1
    6
    worker_nat_ip 是 worker NAT 的 IP 地址,如 34.94.200.1
  4. 使用 gcloud CLI 创建部署:

    $ gcloud deployment-manager deployments create ${INFRA_ID}-security --config 03_security.yaml
  5. 由于 Deployment Manager 的限制,模板不会创建策略绑定,因此您必须手动创建它们:

    $ export MASTER_SA=${INFRA_ID}-m@${PROJECT_NAME}.iam.gserviceaccount.com
    $ gcloud projects add-iam-policy-binding ${PROJECT_NAME} --member "serviceAccount:${MASTER_SA}" --role "roles/compute.instanceAdmin"
    $ gcloud projects add-iam-policy-binding ${PROJECT_NAME} --member "serviceAccount:${MASTER_SA}" --role "roles/compute.networkAdmin"
    $ gcloud projects add-iam-policy-binding ${PROJECT_NAME} --member "serviceAccount:${MASTER_SA}" --role "roles/compute.securityAdmin"
    $ gcloud projects add-iam-policy-binding ${PROJECT_NAME} --member "serviceAccount:${MASTER_SA}" --role "roles/iam.serviceAccountUser"
    $ gcloud projects add-iam-policy-binding ${PROJECT_NAME} --member "serviceAccount:${MASTER_SA}" --role "roles/storage.admin"
    
    $ export WORKER_SA=${INFRA_ID}-w@${PROJECT_NAME}.iam.gserviceaccount.com
    $ gcloud projects add-iam-policy-binding ${PROJECT_NAME} --member "serviceAccount:${WORKER_SA}" --role "roles/compute.viewer"
    $ gcloud projects add-iam-policy-binding ${PROJECT_NAME} --member "serviceAccount:${WORKER_SA}" --role "roles/storage.admin"
  6. 创建服务帐户密钥,并将它保存到本地备用:

    $ gcloud iam service-accounts keys create service-account-key.json --iam-account=${MASTER_SA}

1.7.8.1. 防火墙规则和 IAM 角色的 Deployment Manager 模板

您可以使用以下 Deployment Manager 模板来部署 OpenShift Container Platform 集群所需的安全对象:

03_security.py Deployment Manager 模板

def GenerateConfig(context):

    resources = [{
        'name': context.properties['infra_id'] + '-api',
        'type': 'compute.v1.firewall',
        'properties': {
            'network': context.properties['cluster_network'],
            'allowed': [{
                'IPProtocol': 'tcp',
                'ports': ['6443']
            }],
            'sourceRanges':  ['0.0.0.0/0'],
            'targetTags': [context.properties['infra_id'] + '-master']
        }
    }, {
        'name': context.properties['infra_id'] + '-mcs',
        'type': 'compute.v1.firewall',
        'properties': {
            'network': context.properties['cluster_network'],
            'allowed': [{
                'IPProtocol': 'tcp',
                'ports': ['22623']
            }],
            'sourceRanges':  [
                context.properties['network_cidr'],
                context.properties['master_nat_ip'],
                context.properties['worker_nat_ip']
            ],
            'targetTags': [context.properties['infra_id'] + '-master']
        }
    }, {
        'name': context.properties['infra_id'] + '-health-checks',
        'type': 'compute.v1.firewall',
        'properties': {
            'network': context.properties['cluster_network'],
            'allowed': [{
                'IPProtocol': 'tcp',
                'ports': ['6080', '22624']
            }],
            'sourceRanges': ['35.191.0.0/16', '130.211.0.0/22', '209.85.152.0/22', '209.85.204.0/22'],
            'targetTags': [context.properties['infra_id'] + '-master']
        }
    }, {
        'name': context.properties['infra_id'] + '-etcd',
        'type': 'compute.v1.firewall',
        'properties': {
            'network': context.properties['cluster_network'],
            'allowed': [{
                'IPProtocol': 'tcp',
                'ports': ['2379-2380']
            }],
            'sourceTags': [context.properties['infra_id'] + '-master'],
            'targetTags': [context.properties['infra_id'] + '-master']
        }
    }, {
        'name': context.properties['infra_id'] + '-control-plane',
        'type': 'compute.v1.firewall',
        'properties': {
            'network': context.properties['cluster_network'],
            'allowed': [{
                'IPProtocol': 'tcp',
                'ports': ['10257']
            },{
                'IPProtocol': 'tcp',
                'ports': ['10259']
            }],
            'sourceTags': [
                context.properties['infra_id'] + '-master',
                context.properties['infra_id'] + '-worker'
            ],
            'targetTags': [context.properties['infra_id'] + '-master']
        }
    }, {
        'name': context.properties['infra_id'] + '-internal-network',
        'type': 'compute.v1.firewall',
        'properties': {
            'network': context.properties['cluster_network'],
            'allowed': [{
                'IPProtocol': 'icmp'
            },{
                'IPProtocol': 'tcp',
                'ports': ['22']
            }],
            'sourceRanges':  [context.properties['network_cidr']],
            'targetTags': [
                context.properties['infra_id'] + '-master',
                context.properties['infra_id'] + '-worker'
            ]
        }
    }, {
        'name': context.properties['infra_id'] + '-internal-cluster',
        'type': 'compute.v1.firewall',
        'properties': {
            'network': context.properties['cluster_network'],
            'allowed': [{
                'IPProtocol': 'udp',
                'ports': ['4789', '6081']
            },{
                'IPProtocol': 'tcp',
                'ports': ['9000-9999']
            },{
                'IPProtocol': 'udp',
                'ports': ['9000-9999']
            },{
                'IPProtocol': 'tcp',
                'ports': ['10250']
            },{
                'IPProtocol': 'tcp',
                'ports': ['30000-32767']
            },{
                'IPProtocol': 'udp',
                'ports': ['30000-32767']
            }],
            'sourceTags': [
                context.properties['infra_id'] + '-master',
                context.properties['infra_id'] + '-worker'
            ],
            'targetTags': [
                context.properties['infra_id'] + '-master',
                context.properties['infra_id'] + '-worker'
            ]
        }
    }, {
        'name': context.properties['infra_id'] + '-master-node-sa',
        'type': 'iam.v1.serviceAccount',
        'properties': {
            'accountId': context.properties['infra_id'] + '-m',
            'displayName': context.properties['infra_id'] + '-master-node'
        }
    }, {
        'name': context.properties['infra_id'] + '-worker-node-sa',
        'type': 'iam.v1.serviceAccount',
        'properties': {
            'accountId': context.properties['infra_id'] + '-w',
            'displayName': context.properties['infra_id'] + '-worker-node'
        }
    }]

    return {'resources': resources}

1.7.9. 为 GCP 基础架构创建 RHCOS 集群镜像

您必须对 OpenShift Container Platform 节点的 Google Cloud Platform (GCP) 使用有效的 Red Hat Enterprise Linux CoreOS (RHCOS) 镜像。

流程

  1. 从红帽客户门户上的产品下载 页面或 RHCOS 镜像页面,获取 RHCOS 镜像。

    重要

    RHCOS 镜像可能不会随着 OpenShift Container Platform 的每一发行版本都有改变。您必须下载一个最高版本的镜像,其版本号应小于或等于您安装的 OpenShift Container Platform 版本。如果可用,请使用与 OpenShift Container Platform 版本匹配的镜像版本。只使用 ISO 镜像用于这个流程对于裸机安装,RHCOS qcow2 镜像不被支持。

    文件名包含 OpenShift Container Platform 版本号,格式为 rhcos-<version>-gcp.tar

  2. 导出以下变量:

    $ export IMAGE_SOURCE=<downloaded_image_file_path>
  3. 创建集群镜像:

    $ gcloud compute images create "${INFRA_ID}-rhcos-image" \
        --source-uri="${IMAGE_SOURCE}"

1.7.10. 在 GCP 中创建 bootstrap 机器

您必须在 Google Cloud Platform (GCP) 中创建 bootstrap 机器,以便在 OpenShift Container Platform 集群初始化过程中使用。创建此机器的一种方法是修改提供的 Deployment Manager 模板。

注意

如果不使用提供的 Deployment Manager 模板来创建 bootstrap 机器,您必须检查提供的信息并手动创建基础架构。如果集群没有正确初始化,您可能需要联系红帽支持并提供您的安装日志。

先决条件

  • 配置 GCP 帐户。
  • 为集群生成 Ignition 配置文件。
  • 在 GCP 中创建和配置 VPC 及相关子网。
  • 在 GCP 中创建和配置联网及负载均衡器。
  • 创建 control plane 和计算角色。

流程

  1. 复制 bootstrap 机器的 Deployment Manager 模板一节中的模板,并将它以 04_bootstrap.py 形式保存到计算机上。此模板描述了集群所需的 bootstrap 机器。
  2. 导出资源定义所需的以下变量:

    $ export CONTROL_SUBNET=`gcloud compute networks subnets describe ${INFRA_ID}-master-subnet --region=${REGION} --format json | jq -r .selfLink`
    $ export CLUSTER_IMAGE=`gcloud compute images describe ${INFRA_ID}-rhcos-image --format json | jq -r .selfLink`
    $ export ZONE_0=`gcloud compute regions describe ${REGION} --format=json | jq -r .zones[0] | cut -d "/" -f9`
    $ export ZONE_1=`gcloud compute regions describe ${REGION} --format=json | jq -r .zones[1] | cut -d "/" -f9`
    $ export ZONE_2=`gcloud compute regions describe ${REGION} --format=json | jq -r .zones[2] | cut -d "/" -f9`
  3. 创建存储桶并上传 bootstrap.ign 文件:

    $ gsutil mb gs://${INFRA_ID}-bootstrap-ignition
    $ gsutil cp bootstrap.ign gs://${INFRA_ID}-bootstrap-ignition/
  4. 为 bootstrap 实例创建一个签名的 URL,用于访问 Ignition 配置。将输出中的 URL 导出为变量:

    $ export BOOTSTRAP_IGN=`gsutil signurl -d 1h service-account-key.json \
        gs://${INFRA_ID}-bootstrap-ignition/bootstrap.ign | grep "^gs:" | awk '{print $5}'`
  5. 创建 04_bootstrap.yaml 资源定义文件:

    $ cat <<EOF >04_bootstrap.yaml
    imports:
    - path: 04_bootstrap.py
    
    resources:
    - name: cluster-bootstrap
      type: 04_bootstrap.py
      properties:
        infra_id: '${INFRA_ID}' 1
        region: '${REGION}' 2
        zone: '${ZONE_0}' 3
    
        cluster_network: '${CLUSTER_NETWORK}' 4
        control_subnet: '${CONTROL_SUBNET}' 5
        image: '${CLUSTER_IMAGE}' 6
        machine_type: 'n1-standard-4' 7
        root_volume_size: '128' 8
    
        bootstrap_ign: '${BOOTSTRAP_IGN}' 9
    EOF
    1
    infra_id 是来自于提取步骤的 INFRA_ID 基础架构名称。
    2
    region 是集群要部署到的区域,如 us-east1
    3
    zone 是 Bootstrap 实例要部署到的区域,如 us-east1-b
    4
    cluster_network 是集群网络的 selfLink URL。
    5
    control_subnet 是控制子网的 selfLink URL。
    6
    image 是 RHCOS 镜像的 selfLink URL。
    7
    machine_type 是实例的机器类型,如 n1-standard-4
    8
    bootstrap_ign 是在创建上述已签名 URL 时的 URL 输出。
  6. 使用 gcloud CLI 创建部署:

    $ gcloud deployment-manager deployments create ${INFRA_ID}-bootstrap --config 04_bootstrap.yaml
  7. 由于 Deployment Manager 的限制,模板无法管理负载均衡器成员资格,因此您必须手动添加 bootstrap 机器:

    $ gcloud compute target-pools add-instances \
        ${INFRA_ID}-api-target-pool --instances-zone="${ZONE_0}" --instances=${INFRA_ID}-bootstrap
    $ gcloud compute target-pools add-instances \
        ${INFRA_ID}-ign-target-pool --instances-zone="${ZONE_0}" --instances=${INFRA_ID}-bootstrap

1.7.10.1. bootstrap 机器的 Deployment Manager 模板

您可以使用以下 Deployment Mananger 模板来部署 OpenShift Container Platform 集群所需的 bootstrap 机器:

04_bootstrap.py Deployment Manager 模板

def GenerateConfig(context):

    resources = [{
        'name': context.properties['infra_id'] + '-bootstrap-public-ip',
        'type': 'compute.v1.address',
        'properties': {
            'region': context.properties['region']
        }
    }, {
        'name': context.properties['infra_id'] + '-bootstrap-in-ssh',
        'type': 'compute.v1.firewall',
        'properties': {
            'network': context.properties['cluster_network'],
            'allowed': [{
                'IPProtocol': 'tcp',
                'ports': ['22']
            }],
            'sourceRanges':  ['0.0.0.0/0'],
            'targetTags': [context.properties['infra_id'] + '-bootstrap']
        }
    }, {
        'name': context.properties['infra_id'] + '-bootstrap',
        'type': 'compute.v1.instance',
        'properties': {
            'disks': [{
                'autoDelete': True,
                'boot': True,
                'initializeParams': {
                    'diskSizeGb': context.properties['root_volume_size'],
                    'sourceImage': context.properties['image']
                }
            }],
            'machineType': 'zones/' + context.properties['zone'] + '/machineTypes/' + context.properties['machine_type'],
            'metadata': {
                'items': [{
                    'key': 'user-data',
                    'value': '{"ignition":{"config":{"replace":{"source":"' + context.properties['bootstrap_ign'] + '","verification":{}}},"timeouts":{},"version":"2.1.0"},"networkd":{},"passwd":{},"storage":{},"systemd":{}}',
                }]
            },
            'networkInterfaces': [{
                'subnetwork': context.properties['control_subnet'],
                'accessConfigs': [{
                    'natIP': '$(ref.' + context.properties['infra_id'] + '-bootstrap-public-ip.address)'
                }]
            }],
            'tags': {
                'items': [
                    context.properties['infra_id'] + '-master',
                    context.properties['infra_id'] + '-bootstrap'
                ]
            },
            'zone': context.properties['zone']
        }
    }]

    return {'resources': resources}

1.7.11. 在 GCP 中创建 control plane 机器

您必须在 Google Cloud Platform (GCP) 中创建 control plane 机器,供您的集群使用。创建这些机器的一种方法是修改提供的 Deployment Manager 模板。

注意

如果不使用提供的 Deployment Manager 模板来创建 control plane 机器,您必须检查提供的信息并手动创建基础架构。如果集群没有正确初始化,您可能需要联系红帽支持并提供您的安装日志。

先决条件

  • 配置 GCP 帐户。
  • 为集群生成 Ignition 配置文件。
  • 在 GCP 中创建和配置 VPC 及相关子网。
  • 在 GCP 中创建和配置联网及负载均衡器。
  • 创建 control plane 和计算角色。
  • 创建 bootstrap 机器。

流程

  1. 复制 control plane 机器的 Deployment Manager 模板一节中的模板,并将它以 05_control_plane.py 形式保存到计算机上。此模板描述了集群所需的 control plane 机器。
  2. 导出资源定义需要的以下变量:

    $ export MASTER_SERVICE_ACCOUNT_EMAIL=`gcloud iam service-accounts list | grep "^${INFRA_ID}-master-node " | awk '{print $2}'`
    $ export MASTER_IGNITION=`cat master.ign`
  3. 创建 05_control_plane.yaml 资源定义文件:

    $ cat <<EOF >05_control_plane.yaml
    imports:
    - path: 05_control_plane.py
    
    resources:
    - name: cluster-control-plane
      type: 05_control_plane.py
      properties:
        infra_id: '${INFRA_ID}' 1
        zones: 2
        - '${ZONE_0}'
        - '${ZONE_1}'
        - '${ZONE_2}'
    
        control_subnet: '${CONTROL_SUBNET}' 3
        image: '${CLUSTER_IMAGE}' 4
        machine_type: 'n1-standard-4' 5
        root_volume_size: '128'
        service_account_email: '${MASTER_SERVICE_ACCOUNT_EMAIL}' 6
    
        ignition: '${MASTER_IGNITION}' 7
    EOF
    1
    infra_id 是来自于提取步骤的 INFRA_ID 基础架构名称。
    2
    zones 是 control plane 实例要部署到的区域,如 us-east1-bus-east1-cus-east1-d
    3
    control_subnet 是控制子网的 selfLink URL。
    4
    image 是 RHCOS 镜像的 selfLink URL。
    5
    machine_type 是实例的机器类型,如 n1-standard-4
    6
    service_account_email 是创建的 master 服务帐户的电子邮件地址。
    7
    ignitionmaster.ign 文件的内容。
  4. 使用 gcloud CLI 创建部署:

    $ gcloud deployment-manager deployments create ${INFRA_ID}-control-plane --config 05_control_plane.yaml
  5. 由于 Deployment Manager 的限制,模板无法管理 DNS 条目,因此您必须手动添加 etcd 条目:

    $ export MASTER0_IP=`gcloud compute instances describe ${INFRA_ID}-m-0 --zone ${ZONE_0} --format json | jq -r .networkInterfaces[0].networkIP`
    $ export MASTER1_IP=`gcloud compute instances describe ${INFRA_ID}-m-1 --zone ${ZONE_1} --format json | jq -r .networkInterfaces[0].networkIP`
    $ export MASTER2_IP=`gcloud compute instances describe ${INFRA_ID}-m-2 --zone ${ZONE_2} --format json | jq -r .networkInterfaces[0].networkIP`
    $ if [ -f transaction.yaml ]; then rm transaction.yaml; fi
    $ gcloud dns record-sets transaction start --zone ${INFRA_ID}-private-zone
    $ gcloud dns record-sets transaction add ${MASTER0_IP} --name etcd-0.${CLUSTER_NAME}.${BASE_DOMAIN}. --ttl 60 --type A --zone ${INFRA_ID}-private-zone
    $ gcloud dns record-sets transaction add ${MASTER1_IP} --name etcd-1.${CLUSTER_NAME}.${BASE_DOMAIN}. --ttl 60 --type A --zone ${INFRA_ID}-private-zone
    $ gcloud dns record-sets transaction add ${MASTER2_IP} --name etcd-2.${CLUSTER_NAME}.${BASE_DOMAIN}. --ttl 60 --type A --zone ${INFRA_ID}-private-zone
    $ gcloud dns record-sets transaction add \
      "0 10 2380 etcd-0.${CLUSTER_NAME}.${BASE_DOMAIN}." \
      "0 10 2380 etcd-1.${CLUSTER_NAME}.${BASE_DOMAIN}." \
      "0 10 2380 etcd-2.${CLUSTER_NAME}.${BASE_DOMAIN}." \
      --name _etcd-server-ssl._tcp.${CLUSTER_NAME}.${BASE_DOMAIN}. --ttl 60 --type SRV --zone ${INFRA_ID}-private-zone
    $ gcloud dns record-sets transaction execute --zone ${INFRA_ID}-private-zone
  6. 由于 Deployment Manager 的限制,模板无法管理负载均衡器成员资格,因此您必须手动添加 control plane 机器:

    $ gcloud compute target-pools add-instances ${INFRA_ID}-api-target-pool --instances-zone="${ZONE_0}" --instances=${INFRA_ID}-m-0
    $ gcloud compute target-pools add-instances ${INFRA_ID}-api-target-pool --instances-zone="${ZONE_1}" --instances=${INFRA_ID}-m-1
    $ gcloud compute target-pools add-instances ${INFRA_ID}-api-target-pool --instances-zone="${ZONE_2}" --instances=${INFRA_ID}-m-2
    $ gcloud compute target-pools add-instances ${INFRA_ID}-ign-target-pool --instances-zone="${ZONE_0}" --instances=${INFRA_ID}-m-0
    $ gcloud compute target-pools add-instances ${INFRA_ID}-ign-target-pool --instances-zone="${ZONE_1}" --instances=${INFRA_ID}-m-1
    $ gcloud compute target-pools add-instances ${INFRA_ID}-ign-target-pool --instances-zone="${ZONE_2}" --instances=${INFRA_ID}-m-2

1.7.11.1. control plane 机器的 Deployment Manager 模板

您可以使用以下 Deployment Mananger 模板来部署 OpenShift Container Platform 集群所需的control plane 机器:

05_control_plane.py Deployment Manager 模板

def GenerateConfig(context):

    resources = [{
        'name': context.properties['infra_id'] + '-m-0',
        'type': 'compute.v1.instance',
        'properties': {
            'disks': [{
                'autoDelete': True,
                'boot': True,
                'initializeParams': {
                    'diskSizeGb': context.properties['root_volume_size'],
                    'diskType': 'zones/' + context.properties['zones'][0] + '/diskTypes/pd-ssd',
                    'sourceImage': context.properties['image']
                }
            }],
            'machineType': 'zones/' + context.properties['zones'][0] + '/machineTypes/' + context.properties['machine_type'],
            'metadata': {
                'items': [{
                    'key': 'user-data',
                    'value': context.properties['ignition']
                }]
            },
            'networkInterfaces': [{
                'subnetwork': context.properties['control_subnet']
            }],
            'serviceAccounts': [{
                'email': context.properties['service_account_email'],
                'scopes': ['https://www.googleapis.com/auth/cloud-platform']
            }],
            'tags': {
                'items': [
                    context.properties['infra_id'] + '-master',
                ]
            },
            'zone': context.properties['zones'][0]
        }
    }, {
        'name': context.properties['infra_id'] + '-m-1',
        'type': 'compute.v1.instance',
        'properties': {
            'disks': [{
                'autoDelete': True,
                'boot': True,
                'initializeParams': {
                    'diskSizeGb': context.properties['root_volume_size'],
                    'diskType': 'zones/' + context.properties['zones'][1] + '/diskTypes/pd-ssd',
                    'sourceImage': context.properties['image']
                }
            }],
            'machineType': 'zones/' + context.properties['zones'][1] + '/machineTypes/' + context.properties['machine_type'],
            'metadata': {
                'items': [{
                    'key': 'user-data',
                    'value': context.properties['ignition']
                }]
            },
            'networkInterfaces': [{
                'subnetwork': context.properties['control_subnet']
            }],
            'serviceAccounts': [{
                'email': context.properties['service_account_email'],
                'scopes': ['https://www.googleapis.com/auth/cloud-platform']
            }],
            'tags': {
                'items': [
                    context.properties['infra_id'] + '-master',
                ]
            },
            'zone': context.properties['zones'][1]
        }
    }, {
        'name': context.properties['infra_id'] + '-m-2',
        'type': 'compute.v1.instance',
        'properties': {
            'disks': [{
                'autoDelete': True,
                'boot': True,
                'initializeParams': {
                    'diskSizeGb': context.properties['root_volume_size'],
                    'diskType': 'zones/' + context.properties['zones'][2] + '/diskTypes/pd-ssd',
                    'sourceImage': context.properties['image']
                }
            }],
            'machineType': 'zones/' + context.properties['zones'][2] + '/machineTypes/' + context.properties['machine_type'],
            'metadata': {
                'items': [{
                    'key': 'user-data',
                    'value': context.properties['ignition']
                }]
            },
            'networkInterfaces': [{
                'subnetwork': context.properties['control_subnet']
            }],
            'serviceAccounts': [{
                'email': context.properties['service_account_email'],
                'scopes': ['https://www.googleapis.com/auth/cloud-platform']
            }],
            'tags': {
                'items': [
                    context.properties['infra_id'] + '-master',
                ]
            },
            'zone': context.properties['zones'][2]
        }
    }]

    return {'resources': resources}

1.7.12. 等待 bootstrap 完成并删除 GCP 中的 bootstrap 资源

在 Google Cloud Platform (GCP) 中创建所有所需的基础架构后,请等待您通过安装程序生成的 Ignition 配置文件所置备的机器上完成 bootstrap 过程。

先决条件

  • 配置 GCP 帐户。
  • 为集群生成 Ignition 配置文件。
  • 在 GCP 中创建和配置 VPC 及相关子网。
  • 在 GCP 中创建和配置联网及负载均衡器。
  • 创建 control plane 和计算角色。
  • 创建 bootstrap 机器。
  • 创建 control plane 机器。

流程

  1. 更改到包含安装程序的目录,再运行以下命令:

    $ ./openshift-install wait-for bootstrap-complete --dir=<installation_directory> \ 1
        --log-level info 2
    1
    对于 <installation_directory>,请指定安装文件保存到的目录的路径。
    2
    要查看不同的安装详情,请指定 warndebugerror,而不要指定 info

    如果命令退出且不显示 FATAL 警告,则代表您的 control plane 已被初始化。

  2. 删除 bootstrap 资源:

    $ gcloud compute target-pools remove-instances ${INFRA_ID}-api-target-pool --instances-zone="${ZONE_0}" --instances=${INFRA_ID}-bootstrap
    $ gcloud compute target-pools remove-instances ${INFRA_ID}-ign-target-pool --instances-zone="${ZONE_0}" --instances=${INFRA_ID}-bootstrap
    $ gsutil rm gs://${INFRA_ID}-bootstrap-ignition/bootstrap.ign
    $ gsutil rb gs://${INFRA_ID}-bootstrap-ignition
    $ gcloud deployment-manager deployments delete ${INFRA_ID}-bootstrap

1.7.13. 在 GCP 中创建额外的 worker 机器

您可以通过分散启动各个实例或利用集群外自动化流程(如自动缩放组),在 Google Cloud Platform (GCP) 中为您的集群创建 worker 机器。您还可以利用 OpenShift Container Platform 中的内置集群扩展机制和机器 API。

在本例中,您要使用 Deployment Manager 模板来手动启动一个实例。通过在文件中添加类型为 06_worker.py 的其他资源,即可启动其他实例。

注意

如果不使用提供的 Deployment Manager 模板来创建 worker 机器,您必须检查提供的信息并手动创建基础架构。如果集群没有正确初始化,您可能需要联系红帽支持并提供您的安装日志。

先决条件

  • 配置 GCP 帐户。
  • 为集群生成 Ignition 配置文件。
  • 在 GCP 中创建和配置 VPC 及相关子网。
  • 在 GCP 中创建和配置联网及负载均衡器。
  • 创建 control plane 和计算角色。
  • 创建 bootstrap 机器。
  • 创建 control plane 机器。

流程

  1. 复制本主题的 worker 机器的 Deployment Manager 模板部分中的模板,并将它以 06_worker.py 形式保存到计算机中。此模板描述了集群所需的 worker 机器。
  2. 导出资源定义需要的以下变量:

    $ export COMPUTE_SUBNET=`gcloud compute networks subnets describe ${INFRA_ID}-worker-subnet --region=${REGION} --format json | jq -r .selfLink`
    $ export WORKER_SERVICE_ACCOUNT_EMAIL=`gcloud iam service-accounts list | grep "^${INFRA_ID}-worker-node " | awk '{print $2}'`
    $ export WORKER_IGNITION=`cat worker.ign`
  3. 创建 06_worker.yaml 资源定义文件:

    $ cat <<EOF >06_worker.yaml
    imports:
    - path: 06_worker.py
    
    resources:
    - name: 'w-a-0' 1
      type: 06_worker.py
      properties:
        infra_id: '${INFRA_ID}' 2
        zone: '${ZONE_0}' 3
    
        compute_subnet: '${COMPUTE_SUBNET}' 4
        image: '${CLUSTER_IMAGE}' 5
        machine_type: 'n1-standard-4' 6
        root_volume_size: '128'
        service_account_email: '${WORKER_SERVICE_ACCOUNT_EMAIL}' 7
    
        ignition: '${WORKER_IGNITION}' 8
    EOF
    1
    name 是 worker 机器的名称,如 w-a-0
    2
    infra_id 是来自于提取步骤的 INFRA_ID 基础架构名称。
    3
    zone 是 worker 机器要部署到的区域,如 us-east1-b
    4
    compute_subnet 是计算子网的 selfLink
    5
    image 是 RHCOS 镜像的 selfLink URL。
    6
    machine_type 是实例的机器类型,如 n1-standard-4
    7
    service_account_email 是创建的 worker 服务帐户的电子邮件地址。
    8
    ignitionworker.ign 文件的内容。
  4. 可选:如果要启动更多实例,请在 06_worker.yaml 资源定义文件中包含类型为 06_worker.py 的其他资源。
  5. 使用 gcloud CLI 创建部署:

    $ gcloud deployment-manager deployments create ${INFRA_ID}-worker --config 06_worker.yaml

1.7.13.1. worker 机器的 Deloyment Manager 模板

您可以使用以下 Deloyment Manager 模板来部署 OpenShift Container Platform 集群所需的 worker 机器:

06_worker.py Deployment Manager 模板

def GenerateConfig(context):

    resources = [{
        'name': context.properties['infra_id'] + '-' + context.env['name'],
        'type': 'compute.v1.instance',
        'properties': {
            'disks': [{
                'autoDelete': True,
                'boot': True,
                'initializeParams': {
                    'diskSizeGb': context.properties['root_volume_size'],
                    'sourceImage': context.properties['image']
                }
            }],
            'machineType': 'zones/' + context.properties['zone'] + '/machineTypes/' + context.properties['machine_type'],
            'metadata': {
                'items': [{
                    'key': 'user-data',
                    'value': context.properties['ignition']
                }]
            },
            'networkInterfaces': [{
                'subnetwork': context.properties['compute_subnet']
            }],
            'serviceAccounts': [{
                'email': context.properties['service_account_email'],
                'scopes': ['https://www.googleapis.com/auth/cloud-platform']
            }],
            'tags': {
                'items': [
                    context.properties['infra_id'] + '-worker',
                ]
            },
            'zone': context.properties['zone']
        }
    }]

    return {'resources': resources}

1.7.14. 通过下载二进制文件安装 CLI

您需要安装 CLI(oc) 来使用命令行界面与 OpenShift Container Platform 进行交互。您可在 Linux 、Windows 或 macOS 上安装 oc

重要

如果安装了旧版本的 oc,则无法使用 OpenShift Container Platform 4.3 中的所有命令。下载并安装新版本的 oc

1.7.14.1. 在 Linux 上安装 CLI

您可以按照以下流程在 Linux 上安装 OpenShift CLI(oc)二进制文件。

流程

  1. 访问 Red Hat OpenShift Cluster Manager 网站的 Infrastructure Provider 页面。
  2. 选择您的基础架构供应商及安装类型。
  3. Command-line interface 部分,从下拉菜单中选择 Linux,并点 Download command-line tools
  4. 解包存档:

    $ tar xvzf <file>
  5. oc 二进制代码放到 PATH 中的目录中。

    执行以下命令可以查看当前的 PATH 设置:

    $ echo $PATH

安装 CLI 后,就可以使用oc命令:

$ oc <command>

1.7.14.2. 在 Windows 上安装 CLI

您可以按照以下流程在 Windows 上安装 OpenShift CLI(oc)二进制代码。

流程

  1. 访问 Red Hat OpenShift Cluster Manager 网站的 Infrastructure Provider 页面。
  2. 选择您的基础架构供应商及安装类型。
  3. Command-line interface 部分,从下拉菜单中选择 Windows,点 Download command-line tools
  4. 使用 ZIP 程序解压存档。
  5. oc 二进制代码放到 PATH 中的目录中。

    要查看您的 PATH,请打开命令提示窗口并执行以下命令:

    C:\> path

安装 CLI 后,就可以使用oc命令:

C:\> oc <command>

1.7.14.3. 在 macOS 上安装 CLI

您可以按照以下流程在 macOS 上安装 OpenShift CLI(oc)二进制代码。

流程

  1. 访问 Red Hat OpenShift Cluster Manager 网站的 Infrastructure Provider 页面。
  2. 选择您的基础架构供应商及安装类型。
  3. Command-line interface 部分,从下拉菜单中选择 MacOS,并点 Download command-line tools
  4. 解包和解压存档。
  5. oc 二进制文件移到 PATH 的目录中。

    要查看您的 PATH,打开一个终端窗口并执行以下命令:

    $ echo $PATH

安装 CLI 后,就可以使用oc命令:

$ oc <command>

1.7.15. 登录集群

您可以通过导出集群 kubeconfig 文件,以默认系统用户身份登录集群。kubeconfig 文件包含关于集群的信息,供 CLI 用于将客户端连接到正确集群和 API 服务器。该文件特只适用于一个特定的集群,在 OpenShift Container Platform 安装过程中创建。

先决条件

  • 部署 OpenShift Container Platform 集群。
  • 安装 oc CLI。

流程

  1. 导出 kubeadmin 凭证:

    $ export KUBECONFIG=<installation_directory>/auth/kubeconfig 1
    1
    对于 <installation_directory>,请指定安装文件保存到的目录的路径。
  2. 使用导出的配置,验证能否成功运行 oc 命令:

    $ oc whoami
    system:admin

1.7.16. 批准机器的 CSR

将机器添加到集群时,会为您添加的每台机器生成两个待处理证书签名请求(CSR)。您必须确认这些 CSR 已获得批准,或根据需要自行批准。

先决条件

  • 您已将机器添加到集群中。

流程

  1. 确认集群可以识别这些机器:

    $ oc get nodes
    
    NAME      STATUS    ROLES   AGE  VERSION
    master-0  Ready     master  63m  v1.16.2
    master-1  Ready     master  63m  v1.16.2
    master-2  Ready     master  64m  v1.16.2
    worker-0  NotReady  worker  76s  v1.16.2
    worker-1  NotReady  worker  70s  v1.16.2

    输出将列出您创建的所有机器。

  2. 检查待处理的 CSR,并确保添加到集群中的每台机器都有 PendingApproved 状态的客户端和服务器请求:

    $ oc get csr
    
    NAME        AGE     REQUESTOR                                                                   CONDITION
    csr-8b2br   15m     system:serviceaccount:openshift-machine-config-operator:node-bootstrapper   Pending 1
    csr-8vnps   15m     system:serviceaccount:openshift-machine-config-operator:node-bootstrapper   Pending
    csr-bfd72   5m26s   system:node:ip-10-0-50-126.us-east-2.compute.internal                       Pending 2
    csr-c57lv   5m26s   system:node:ip-10-0-95-157.us-east-2.compute.internal                       Pending
    ...
    1
    客户端请求 CSR。
    2
    服务器请求 CSR。

    在本例中,两台机器加入了集群。您可能会在列表中看到更多已批准的 CSR。

  3. 如果 CSR 没有获得批准,请在所添加机器的所有待处理 CSR 都处于 Pending 状态后,为您的集群机器批准这些 CSR:

    注意

    由于 CSR 会自动轮转,因此请在将机器添加到集群后一小时内批准您的 CSR。如果没有在一小时内批准,证书将会轮转,每个节点将会存在多个证书。您必须批准所有这些证书。批准初始 CSR 后,集群的 kube-controller-manager 会自动批准后续的节点客户端 CSR。您必须实施一个方法来自动批准 kubelet 提供的证书请求。

    • 若要单独批准,请对每个有效的 CSR 运行以下命令:

      $ oc adm certificate approve <csr_name> 1
      1
      <csr_name> 是当前 CSR 列表中 CSR 的名称。
    • 要批准所有待处理的 CSR,请运行以下命令:

      $ oc get csr -o go-template='{{range .items}}{{if not .status}}{{.metadata.name}}{{"\n"}}{{end}}{{end}}' | xargs oc adm certificate approve

其他信息

1.7.17. 可选:添加入口 DNS 记录

如果您在创建 Kubernetes 清单并生成 Ignition 配置时删除了 DNS 区配置,您必须手动创建指向入口负载均衡器的 DNS 记录。您可以创建通配符 *.apps.{baseDomain}. 或具体的记录。您可以根据自己的要求使用 A、CNAME 和其他记录。

先决条件

  • 配置 GCP 帐户。
  • 在创建 Kubernetes 清单并生成 Ignition 配置时删除 DNS 区配置。
  • 在 GCP 中创建和配置 VPC 及相关子网。
  • 在 GCP 中创建和配置联网及负载均衡器。
  • 创建 control plane 和计算角色。
  • 创建 bootstrap 机器。
  • 创建 control plane 机器。
  • 创建 worker 机器。

流程

  1. 等待入口路由器创建负载均衡器并填充 EXTERNAL-IP 字段:

    $ oc -n openshift-ingress get service router-default
    NAME             TYPE           CLUSTER-IP      EXTERNAL-IP      PORT(S)                      AGE
    router-default   LoadBalancer   172.30.18.154   35.233.157.184   80:32288/TCP,443:31215/TCP   98
  2. 在您的公共和专用区中添加 A 记录:

    $ export ROUTER_IP=`oc -n openshift-ingress get service router-default --no-headers | awk '{print $4}'`
    
    $ if [ -f transaction.yaml ]; then rm transaction.yaml; fi
    $ gcloud dns record-sets transaction start --zone ${BASE_DOMAIN_ZONE_NAME}
    $ gcloud dns record-sets transaction add ${ROUTER_IP} --name \*.apps.${CLUSTER_NAME}.${BASE_DOMAIN}. --ttl 300 --type A --zone ${BASE_DOMAIN_ZONE_NAME}
    $ gcloud dns record-sets transaction execute --zone ${BASE_DOMAIN_ZONE_NAME}
    
    $ if [ -f transaction.yaml ]; then rm transaction.yaml; fi
    $ gcloud dns record-sets transaction start --zone ${INFRA_ID}-private-zone
    $ gcloud dns record-sets transaction add ${ROUTER_IP} --name \*.apps.${CLUSTER_NAME}.${BASE_DOMAIN}. --ttl 300 --type A --zone ${INFRA_ID}-private-zone
    $ gcloud dns record-sets transaction execute --zone ${INFRA_ID}-private-zone

    如果需要添加特定域而不使用通配符,可以为集群的每个当前路由创建条目:

    $ oc get --all-namespaces -o jsonpath='{range .items[*]}{range .status.ingress[*]}{.host}{"\n"}{end}{end}' routes
    oauth-openshift.apps.your.cluster.domain.example.com
    console-openshift-console.apps.your.cluster.domain.example.com
    downloads-openshift-console.apps.your.cluster.domain.example.com
    alertmanager-main-openshift-monitoring.apps.your.cluster.domain.example.com
    grafana-openshift-monitoring.apps.your.cluster.domain.example.com
    prometheus-k8s-openshift-monitoring.apps.your.cluster.domain.example.com

1.7.18. 在用户置备的基础架构上完成 GCP 安装

在 Google Cloud Platform (GCP) 用户置备的基础架构上启动 OpenShift Container Platform 安装后,您可以监控集群事件,直到集群就绪可用。

先决条件

  • 在用户置备的 GCP 基础架构上为 OpenShift Container Platform 集群部署 bootstrap 机器。
  • 安装 oc CLI 并登录。

流程

  1. 完成集群安装:

    $ ./openshift-install --dir=<installation_directory> wait-for install-complete 1
    
    INFO Waiting up to 30m0s for the cluster to initialize...
    1
    对于 <installation_directory>,请指定安装文件保存到的目录的路径。
    重要

    安装程序生成的 Ignition 配置文件中所含的证书会在 24 小时后过期。您必须以非降级状态持续运行集群 24 小时,以确保完成第一次证书轮转。

  2. 观察集群的运行状态。

    1. 运行以下命令来查看当前的集群版本和状态:

      $ oc get clusterversion
      NAME      VERSION   AVAILABLE   PROGRESSING   SINCE   STATUS
      version             False       True          24m     Working towards 4.3.0-0: 99% complete
    2. 运行以下命令,查看 control plane 上由 Cluster Version Operator (CVO) 管理的 Operator:

      $ oc get clusteroperators
      NAME                                       VERSION   AVAILABLE   PROGRESSING   DEGRADED   SINCE
      authentication                             4.3.0-0   True        False         False      6m18s
      cloud-credential                           4.3.0-0   True        False         False      17m
      cluster-autoscaler                         4.3.0-0   True        False         False      80s
      console                                    4.3.0-0   True        False         False      3m57s
      dns                                        4.3.0-0   True        False         False      22m
      image-registry                             4.3.0-0   True        False         False      5m4s
      ingress                                    4.3.0-0   True        False         False      4m38s
      insights                                   4.3.0-0   True        False         False      21m
      kube-apiserver                             4.3.0-0   True        False         False      12m
      kube-controller-manager                    4.3.0-0   True        False         False      12m
      kube-scheduler                             4.3.0-0   True        False         False      11m
      machine-api                                4.3.0-0   True        False         False      18m
      machine-config                             4.3.0-0   True        False         False      22m
      marketplace                                4.3.0-0   True        False         False      5m38s
      monitoring                                 4.3.0-0   True        False         False      86s
      network                                    4.3.0-0   True        False         False      14m
      node-tuning                                4.3.0-0   True        False         False      6m8s
      openshift-apiserver                        4.3.0-0   True        False         False      6m48s
      openshift-controller-manager               4.3.0-0   True        False         False      12m
      openshift-samples                          4.3.0-0   True        False         False      67s
      operator-lifecycle-manager                 4.3.0-0   True        False         False      15m
      operator-lifecycle-manager-catalog         4.3.0-0   True        False         False      15m
      operator-lifecycle-manager-packageserver   4.3.0-0   True        False         False      6m48s
      service-ca                                 4.3.0-0   True        False         False      17m
      service-catalog-apiserver                  4.3.0-0   True        False         False      6m18s
      service-catalog-controller-manager         4.3.0-0   True        False         False      6m19s
      storage                                    4.3.0-0   True        False         False      6m20s
    3. 运行以下命令来查看您的集群 Pod:

      $ oc get pods --all-namespaces
      NAMESPACE                                               NAME                                                                READY     STATUS      RESTARTS   AGE
      kube-system                                             etcd-member-ip-10-0-3-111.us-east-2.compute.internal                1/1       Running     0          35m
      kube-system                                             etcd-member-ip-10-0-3-239.us-east-2.compute.internal                1/1       Running     0          37m
      kube-system                                             etcd-member-ip-10-0-3-24.us-east-2.compute.internal                 1/1       Running     0          35m
      openshift-apiserver-operator                            openshift-apiserver-operator-6d6674f4f4-h7t2t                       1/1       Running     1          37m
      openshift-apiserver                                     apiserver-fm48r                                                     1/1       Running     0          30m
      openshift-apiserver                                     apiserver-fxkvv                                                     1/1       Running     0          29m
      openshift-apiserver                                     apiserver-q85nm                                                     1/1       Running     0          29m
      ...
      openshift-service-ca-operator                           openshift-service-ca-operator-66ff6dc6cd-9r257                      1/1       Running     0          37m
      openshift-service-ca                                    apiservice-cabundle-injector-695b6bcbc-cl5hm                        1/1       Running     0          35m
      openshift-service-ca                                    configmap-cabundle-injector-8498544d7-25qn6                         1/1       Running     0          35m
      openshift-service-ca                                    service-serving-cert-signer-6445fc9c6-wqdqn                         1/1       Running     0          35m
      openshift-service-catalog-apiserver-operator            openshift-service-catalog-apiserver-operator-549f44668b-b5q2w       1/1       Running     0          32m
      openshift-service-catalog-controller-manager-operator   openshift-service-catalog-controller-manager-operator-b78cr2lnm     1/1       Running     0          31m

    当前集群版本是 AVAILABLE 时表示安装完毕。

1.7.19. 后续步骤