12.5.17. 在 RHOSP 上创建网络资源

在您自己的基础架构的 Red Hat OpenStack Platform(RHOSP)安装上创建 OpenShift Container Platform 所需的网络资源。为节省时间,可以运行提供的 Ansible playbook 来生成安全组、网络、子网、路由器和端口。

先决条件

  • Python 3 已安装在您的机器上。
  • 您下载了"下载 playbook 依赖项"中的模块。
  • 下载了"下载安装 playbook"中的 playbook。

流程

  1. 可选:为 inventory.yaml playbook 添加一个外部网络值:

    inventory.yaml Ansible playbook 中的外部网络值示例

    ...
          # The public network providing connectivity to the cluster. If not
          # provided, the cluster external connectivity must be provided in another
          # way.
    
          # Required for os_api_fip, os_ingress_fip, os_bootstrap_fip.
          os_external_network: 'external'
    ...

    重要

    如果没有为 inventory.yaml 文件中的 os_external_network 提供值,则必须确保虚拟机可以自行访问 Glance 和外部连接。

  2. 可选:将外部网络和浮动 IP(FIP)地址值添加到 inventory.yaml playbook:

    inventory.yaml Ansible playbook 中的 FIP 值示例

    ...
          # OpenShift API floating IP address. If this value is non-empty, the
          # corresponding floating IP will be attached to the Control Plane to
          # serve the OpenShift API.
          os_api_fip: '203.0.113.23'
    
          # OpenShift Ingress floating IP address. If this value is non-empty, the
          # corresponding floating IP will be attached to the worker nodes to serve
          # the applications.
          os_ingress_fip: '203.0.113.19'
    
          # If this value is non-empty, the corresponding floating IP will be
          # attached to the bootstrap machine. This is needed for collecting logs
          # in case of install failure.
          os_bootstrap_fip: '203.0.113.20'

    重要

    如果您没有为 os_api_fipos_ingress_fip 定义值,则必须执行安装后的网络配置。

    如果您没有为 os_bootstrap_fip 定义值,安装程序将无法从失败的安装中下载调试信息。

    如需更多信息,请参阅"启用对环境的访问"。

  3. 在命令行中,通过运行 security-groups.yaml playbook 来创建安全组:

    $ ansible-playbook -i inventory.yaml security-groups.yaml
  4. 在命令行中,通过运行 network.yaml playbook 来创建一个网络、子网和路由器:

    $ ansible-playbook -i inventory.yaml network.yaml
  5. 可选:如果要控制 Nova 服务器使用的默认解析程序,请运行 RHOSP CLI 命令:

    $ openstack subnet set --dns-nameserver <server_1> --dns-nameserver <server_2> "$INFRA_ID-nodes"

另外,您可以使用您创建的 inventory.yaml 文件来自定义安装。例如,您可以部署使用裸机的集群。

12.5.17.1. 使用裸机部署集群

如果您希望集群使用裸机,请修改 inventory.yaml 文件。集群可以同时在裸机上运行 control plane 和计算机器,或只运行计算机器。

使用 Kuryr 的集群中不支持裸机计算机器。

注意

确保 install-config.yaml 文件反映了您用于裸机 worker 的 RHOSP 网络是否支持浮动 IP 地址。

先决条件

  • RHOSP Bare Metal 服务(Ironic)通过 RHOSP Compute API 启用并访问。
  • 裸机可作为一个 RHOSP 类别提供。
  • RHOSP 网络支持 VM 和裸机服务器附加。
  • 您的网络配置不依赖于供应商网络。不支持提供商网络。
  • 如果要将机器部署到预先存在的网络中,则会置备 RHOSP 子网。
  • 如果要在安装程序置备的网络中部署机器,RHOSP Bare Metal 服务(Ironic)可以侦听并在租户网络上运行的 Preboot eXecution Environment(PXE)引导机器。
  • 作为 OpenShift Container Platform 安装过程的一部分,创建了 inventory.yaml 文件。

流程

  1. inventory.yaml 文件中,编辑机器的类别:

    1. 如果要使用裸机 control plane 机器,将 os_flavor_master 的值改为裸机类型。
    2. os_flavor_worker 的值改为裸机类型。

      裸机 inventory.yaml 文件示例

      all:
        hosts:
          localhost:
            ansible_connection: local
            ansible_python_interpreter: "{{ansible_playbook_python}}"
      
            # User-provided values
            os_subnet_range: '10.0.0.0/16'
            os_flavor_master: 'my-bare-metal-flavor' 1
            os_flavor_worker: 'my-bare-metal-flavor' 2
            os_image_rhcos: 'rhcos'
            os_external_network: 'external'
      ...

      1
      如果要使用裸机 control plane 机器,请将此值更改为一个裸机类型。
      2
      将这个值更改为用于计算机器的裸机类别。

使用更新的 inventory.yaml 文件完成安装过程。部署期间创建的机器使用添加到文件的类别。

注意

在等待裸机引导时,安装程序可能会超时。

如果安装程序超时,重启并使用安装程序的 wait-for 命令完成部署。例如:

./openshift-install wait-for install-complete --log-level debug