3.13. 为 bootstrap 虚拟机分配静态 IP 地址


如果要在 baremetal 网络中在没有 DHCP 服务器的情况下部署 OpenShift Container Platform,则必须使用 Ignition 为 bootstrap 虚拟机配置静态 IP 地址。

流程

  1. 创建 ignition 配置文件:

    $ ./openshift-baremetal-install --dir <cluster_configs> create ignition-configs

    <cluster_configs> 替换为集群配置文件的路径。

  2. 创建 bootstrap_config.sh 文件:

    #!/bin/bash
    
    BOOTSTRAP_CONFIG="[connection]
    type=ethernet
    interface-name=ens3
    [ethernet]
    [ipv4]
    method=manual
    addresses=<ip_address>/<cidr>
    gateway=<gateway_ip_address>
    dns=<dns_ip_address>"
    
    cat <<_EOF_ > bootstrap_network_config.ign
    {
      "path": "/etc/NetworkManager/system-connections/ens3.nmconnection",
      "mode": 384,
      "contents": {
        "source": "data:text/plain;charset=utf-8;base64,$(echo "${BOOTSTRAP_CONFIG}" | base64 -w 0)"
      }
    }
    _EOF_
    
    mv <cluster_configs>/bootstrap.ign <cluster_configs>/bootstrap.ign.orig
    
    jq '.storage.files += $input' <cluster_configs>/bootstrap.ign.orig --slurpfile input bootstrap_network_config.ign > <cluster_configs>/bootstrap.ign

    <ip_address><cidr> 替换为地址范围的 IP 地址和 CIDR。使用 baremetal 网络上的网关的 IP 地址替换 <gateway_ip_address>。将 <dns_ip_address> 替换为 baremetal 网络上的 DNS 服务器的 IP 地址。将 <cluster_configs> 替换为集群配置文件的路径。

  3. 使 bootstrap_config.sh 文件可执行:

    $ chmod 755 bootstrap_config.sh
  4. 运行 bootstrap_config.sh 脚本来创建 bootstrap_network_config.ign 文件:

    $ ./bootstrap_config.sh
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.