IBM Cloud Docs
连接 Microsoft Azure 主机

连接 Microsoft Azure 主机

了解如何将 Microsoft Azure 云主机连接到 IBM Cloud Satellite®。

要连接 Red Hat CoreOS (RHCOS) 主机,必须为 Red Hat CoreOS启用您的位置。 有关更多信息,请参阅 是否为 Red Hat CoreOS启用了我的位置?。 请注意,您仍可以将 Red Hat Enterprise Linux 主机连接到为 Red Hat CoreOS启用的位置。

开始之前,请确保在本地数据中心,IBM Cloud或公共云提供者中创建符合 最低硬件需求 的主机。

将主机连接到位置后,Satellite 将禁用以 root 用户身份使用 SSH 登录主机以实现安全目的的能力。 如果尝试以 root 用户身份通过 SSH 连接到成功连接到某个位置的主机,那么可能会看到错误消息。 要将 SSH 功能复原到机器中,可以 除去主机 并重新装入操作系统。

不确定要连接到您所在位置的主机数? 请参阅 确定 Satellite 位置

将 Azure 主机添加到 Satellite

您可以使用从 Microsoft Azure添加的主机来创建 IBM Cloud Satellite 位置。

如果要在您所在位置使用 Red Hat CoreOS (RHCOS) 主机,请向 Azure 帐户提供 RHCOS 映像文件。 有关更多信息,请参阅 创建定制 Linux 映像。 要查找 RHCOS 映像,请参阅 可用映像 列表。 请注意,必须至少使用 V 4.9。

要添加的所有主机都必须满足常规主机需求,例如 RHEL 8 软件包和联网设置。 有关更多信息,请参阅 主机需求

准备工作

要将主机从 Azure 添加到 Satellite 位置,

  1. Satellite 控制台中,选择要添加 Azure 主机的位置。

  2. 检索必须在主机上运行的主机注册脚本,以使其对 IBM Cloud Satellite 位置可视。

    1. 主机 选项卡中,单击 连接主机
    2. 可选: 添加稍后用于 自动将 主机分配给位置中启用了 Satellite的 IBM Cloud 服务的主机标签。 标签必须作为键/值对提供,并且必须与来自服务的请求匹配。 缺省情况下,主机会获得 cpuosmemory 标签,但您可能希望添加更多内容来控制自动分配,例如 env=prodservice=database
    3. 输入脚本的文件名或使用为您生成的名称。
    4. 单击 下载脚本 以生成主机脚本并将脚本下载到本地计算机。 请注意,脚本中的令牌是 API 密钥,应该将其作为敏感信息进行处理和保护。
  3. 仅 RHEL 7 打开注册脚本。 在 API_URL 行之后,添加一个部分以将必需的 RHEL 软件包与预订管理器一起拉取。

    # Grow the base volume group first
    echo -e "r\ne\ny\nw\ny\ny\n" | gdisk /dev/sda
    # Mark result as true as this returns a non-0 RC when syncing disks
    echo -e "n\n\n\n\n\nw\n" | fdisk /dev/sda || true
    partx -l /dev/sda || true
    partx -v -a /dev/sda || true
    pvcreate /dev/sda5
    vgextend rootvg /dev/sda5
    # Grow the TMP LV
    lvextend -L+10G /dev/rootvg/tmplv
    xfs_growfs /dev/rootvg/tmplv
    # Grow the var LV
    lvextend -L+20G /dev/rootvg/varlv
    xfs_growfs /dev/rootvg/varlv
    
    # Enable Azure RHEL Updates
    yum update --disablerepo=* --enablerepo="*microsoft*" -y
    yum-config-manager --enable '*'
    yum repolist all
    yum install container-selinux -y
    echo "repos enabled"
    
  4. 从本地命令行,登录到 Azure 帐户

    az login
    
  5. 创建满足 Satellite的主机联网需求的网络安全组。

    1. 在资源组中创建网络安全组。 有关更多信息,请参阅 Azure CLI 文档
      az network nsg create --name <network_security_group_name> --resource-group <resource_group_name>
      
    2. 在网络安全组中创建规则以允许 SSH 进入虚拟机。 有关更多信息,请参阅 Azure CLI 文档
      az network nsg rule create --name ssh --nsg-name <network_security_group_name> --priority 1000 --resource-group <resource_group_name> --destination-port-ranges 22 --access Allow --protocol Tcp
      
    3. 在网络安全组中创建规则以满足 最低主机联网需求。 有关更多信息,请参阅 Azure CLI 文档
      az network nsg rule create --name satellite --nsg-name <network_security_group_name> --priority 1010 --resource-group <resource_group_name> --destination-port-ranges 80 443 30000-32767 --access Allow
      
    4. 可选: 验证您的网络安全组是否满足主机联网需求,例如在 示例设置 中。
  6. 创建虚拟机以充当 Satellite 位置资源的主机,包括控制平面以及要创建的任何 Red Hat OpenShift 集群。 以下命令将根据计算,磁盘和映像的 最低主机需求 创建 6 VM。 将在先前创建的资源组和网络安全组中创建 VM。 有关更多信息,请参阅 Azure CLI 文档

    • 创建 Red Hat Enterprise Linux 主机
      az vm create --name <vm_name> --resource-group RESOURCE-GROUP --admin-user USERNAME --admin-password PASSWORD --image RedHat:RHEL:7-LVM:latest --nsg <network_security_group> --os-disk-name DISK_NAME --os-disk-size-gb 128 --size Standard_D4s_v3 --count 6 --custom-data FILEPATH_TO_HOST_REGISTRATION_SCRIPT
      
    • 创建 Red Hat CoreOS 主机
      az vm create --name VM --resource-group RESOURCE-GROUP --image RHCOS-IMAGE --admin-username USERNAME  --admin-password PASSWORD--size Standard_B8ms --data-disk-sizes-gb 100 --custom-data FILEPATH-IGNITION-SCRIPT-LOCATION --os-disk-size-gb 100 --public-ip-sku Standard --generate-ssh-keys
      

    如果您不想在 VM 创建期间传递 --custom-data 命令选项,那么可以在供应后在每个 VM 上运行主机注册脚本。

  7. 等待要创建的实例。 在创建实例期间,脚本会自动运行。 此过程需要几分钟才能完成。

  8. 监视注册脚本的进度。

    1. 获取其中一个实例的公共 IP 地址。 有关更多信息,请参阅 Azure CLI 文档
      az vm list-ip-addresses -g <resource_group> -n <vm_name>
      
    2. 登录到实例。
      ssh <username>:<public_IP_address>
      
    3. 监视注册脚本的进度。
      journalctl -f -u ibm-host-attach
      
  9. Satellite 控制台中,检查主机是否显示在您所在位置的 主机 选项卡中。 当可以建立与机器的连接时,所有主机都会显示 运行状况 状态 Ready状态Unassigned,因为尚未将这些主机分配给 Satellite 位置控制平面或 Red Hat OpenShift on IBM Cloud 集群。

  10. 将主机分配到 Satellite 控制平面Red Hat OpenShift on IBM Cloud 集群

Azure 的安全组设置

主机联网需求 中所述,Azure 主机必须有权连接到 IBM Cloud Satellite。 您可能会发现需要更新 Azure中的安全组设置,类似于以下示例。

以下示例是您可能为 Azure创建的安全组。

"securityRules": [
            {
                "name": "satellite",
                "id": "/subscriptions/.../securityRules/satellite",
                "type": "Microsoft.Network/networkSecurityGroups/securityRules",
                "properties": {
                    "provisioningState": "Succeeded",
                    "protocol": "*",
                    "sourcePortRange": "*",
                    "sourceAddressPrefix": "*",
                    "destinationAddressPrefix": "*",
                    "access": "Allow",
                    "priority": 100,
                    "direction": "Inbound",
                    "sourcePortRanges": [],
                    "destinationPortRanges": [
                        "80",
                        "443",
                        "30000-32767"
                    ],
                    "sourceAddressPrefixes": [],
                    "destinationAddressPrefixes": []
                }
            },
            {
                "name": "SSH",
                "id": "/subscriptions/.../securityRules/SSH",
                "type": "Microsoft.Network/networkSecurityGroups/securityRules",
                "properties": {
                    "provisioningState": "Succeeded",
                    "protocol": "TCP",
                    "sourcePortRange": "*",
                    "destinationPortRange": "22",
                    "sourceAddressPrefix": "*",
                    "destinationAddressPrefix": "*",
                    "access": "Allow",
                    "priority": 110,
                    "direction": "Inbound",
                    "sourcePortRanges": [],
                    "destinationPortRanges": [],
                    "sourceAddressPrefixes": [],
                    "destinationAddressPrefixes": []
                }
            }
]

有关更多信息,请参阅 Microsoft Azure 文档中的 网络安全组

我将主机添加到我的位置,下一步是什么?

现在,您已将主机添加到位置,可以将它们分配到位置控制平面或 IBM Cloud 服务。

  1. 主机分配给位置控制平面分配给 IBM Cloud 服务
  2. 创建 Satellite-enabled IBM Cloud 服务,例如 Red Hat OpenShift 集群。 您甚至可以 将现有 Red Hat OpenShift 集群注册到您的位置 以用作部署目标。
  3. 使用 Satellite 配置 管理应用程序
  4. 创建 Satellite 集群存储模板
  5. 了解有关 Satellite 链接组件 的更多信息,以及如何使用端点来管理位置与 IBM Cloud之间的网络流量。

需要帮助吗? 查看 获取支持,您可以在其中找到有关云状态,问题和日志记录的信息; 联系支持人员; 以及设置 IBM Cloud 平台相关项的电子邮件通知首选项。