搜索

8.2. 配置 Azure Stack Hub 帐户

download PDF

在安装 OpenShift Container Platform 之前,您必须配置 Microsoft Azure 帐户。

重要

所有通过公共端点提供的 Azure 资源均存在资源名称的限制,您无法创建使用某些名称的资源。如需 Azure 限制词语列表,请参阅 Azure 文档中的解决保留资源名称错误

8.2.1. Azure Stack Hub 帐户限制

OpenShift Container Platform 集群使用多个 Microsoft Azure Stack Hub 组件,Azure Stack Hub 中的默认配额类型会影响您安装 OpenShift Container Platform 集群的能力。

下表总结了 Azure Stack Hub 组件,它们的限值会影响您安装和运行 OpenShift Container Platform 集群的能力。

组件默认所需的组件数描述

vCPU

56

默认集群需要 56 个 vCPU,因此您必须提高帐户限值。

默认情况下,每个集群创建以下实例:

  • 一台 Bootstrap 机器,在安装后删除
  • 三个 control plane 机器
  • 三个计算(compute)机器

因为 bootstrap、control plane 和 worker 机器使用 Standard_DS4_v2 虚拟机(8 个 vCPU),所以默认集群需要 56 个 vCPU。bootstrap 节点虚拟机仅在安装过程中使用。

若要部署更多 worker 节点、启用自动扩展、部署大型工作负载或使用不同的实例类型,您必须进一步提高帐户的 vCPU 限值,以确保集群可以部署您需要的机器。

VNet

1

每个默认集群都需要一个虚拟网络 (VNet),此网络包括两个子网。

网络接口

7

每个默认集群都需要 7 个网络接口。如果您要创建更多机器或者您部署的工作负载要创建负载均衡器,则集群会使用更多的网络接口。

网络安全组

2

每个集群为 VNet 中的每个子网创建网络安全组。默认集群为 control plane 和计算节点子网创建网络安全组:

controlplane

允许从任何位置通过端口 6443 访问 control plane 机器

node

允许从互联网通过端口 80 和 443 访问 worker 节点

网络负载均衡器

3

每个集群都会创建以下负载均衡器

default

用于在 worker 机器之间对端口 80 和 443 的请求进行负载均衡的公共 IP 地址

internal

用于在 control plane 机器之间对端口 6443 和 22623 的请求进行负载均衡的专用 IP 地址

external

用于在 control plane 机器之间对端口 6443 的请求进行负载均衡的公共 IP 地址

如果您的应用程序创建了更多的 Kubernetes LoadBalancer 服务对象,您的集群会使用更多的负载均衡器。

公共 IP 地址

2

公共负载均衡器使用一个公共 IP 地址。bootstrap 机器也使用一个公共 IP 地址,以便您可以在安装期间通过 SSH 连接到该机器来进行故障排除。bootstrap 节点的 IP 地址仅在安装过程中使用。

专用 IP 地址

7

内部负载均衡器、三台 control plane 机器中的每一台以及三台 worker 机器中的每一台各自使用一个专用 IP 地址。

其他资源

8.2.2. 在 Azure Stack Hub 中配置 DNS 区域

要在 Azure Stack Hub 上成功安装 OpenShift Container Platform,您必须在 Azure Stack Hub DNS 区域中创建 DNS 记录。DNS 区域必须对域具有权威。要将注册商的 DNS 区域委派给 Azure Stack Hub,请参阅 Microsoft 有关 Azure Stack Hub 数据中心 DNS 集成的文档。

8.2.3. 所需的 Azure Stack Hub 角色

Microsoft Azure Stack Hub 帐户必须具有您使用的订阅的以下角色:

  • 所有者

要在 Azure 门户上设置角色,请参阅 Microsoft 文档中的通过基于角色的访问控制管理对 Azure Stack Hub 中资源的管理访问权限

8.2.4. 创建服务主体

由于 OpenShift Container Platform 及其安装程序使用 Azure Resource Manager 创建 Microsoft Azure 资源,因此您必须创建一个服务主体来代表它。

先决条件

  • 安装或更新 Azure CLI
  • 您的 Azure 帐户具有您所用订阅所需的角色。

流程

  1. 注册您的环境:

    $ az cloud register -n AzureStackCloud --endpoint-resource-manager <endpoint> 1
    1
    指定 Azure Resource Manager 端点 'https://management.<region>.<fqdn>/'。

    详情请查看 Microsoft 文档

  2. 设置活跃环境:

    $ az cloud set -n AzureStackCloud
  3. 更新您的环境配置,以使用 Azure Stack Hub 的特定 API 版本:

    $ az cloud update --profile 2019-03-01-hybrid
  4. 登录 Azure CLI:

    $ az login

    如果您在多租户环境中,还必须提供租户 ID。

  5. 如果您的 Azure 帐户使用订阅,请确定您使用正确的订阅:

    1. 查看可用帐户列表并记录您要用于集群的订阅的 tenantId 值:

      $ az account list --refresh

      输出示例

      [
        {
          "cloudName": AzureStackCloud",
          "id": "9bab1460-96d5-40b3-a78e-17b15e978a80",
          "isDefault": true,
          "name": "Subscription Name",
          "state": "Enabled",
          "tenantId": "6057c7e9-b3ae-489d-a54e-de3f6bf6a8ee",
          "user": {
            "name": "you@example.com",
            "type": "user"
          }
        }
      ]

    2. 查看您的活跃帐户详情,确认 tenantId 值与您要使用的订阅匹配:

      $ az account show

      输出示例

      {
        "environmentName": AzureStackCloud",
        "id": "9bab1460-96d5-40b3-a78e-17b15e978a80",
        "isDefault": true,
        "name": "Subscription Name",
        "state": "Enabled",
        "tenantId": "6057c7e9-b3ae-489d-a54e-de3f6bf6a8ee", 1
        "user": {
          "name": "you@example.com",
          "type": "user"
        }
      }

      1
      确保 tenantId 参数的值是正确的订阅 ID。
    3. 如果您使用的订阅不正确,请更改活跃的订阅:

      $ az account set -s <subscription_id> 1
      1
      指定订阅 ID。
    4. 验证订阅 ID 更新:

      $ az account show

      输出示例

      {
        "environmentName": AzureStackCloud",
        "id": "33212d16-bdf6-45cb-b038-f6565b61edda",
        "isDefault": true,
        "name": "Subscription Name",
        "state": "Enabled",
        "tenantId": "8049c7e9-c3de-762d-a54e-dc3f6be6a7ee",
        "user": {
          "name": "you@example.com",
          "type": "user"
        }
      }

  6. 记录输出中的 tenantIdid 参数值。OpenShift Container Platform 安装过程中需要这些值。
  7. 为您的帐户创建服务主体:

    $ az ad sp create-for-rbac --role Contributor --name <service_principal> \ 1
      --scopes /subscriptions/<subscription_id> 2
      --years <years> 3
    1
    指定服务主体名称。
    2
    指定订阅 ID。
    3
    指定年数。默认情况下,服务主体在一年后过期。通过使用 --years 选项,您可以扩展服务主体的有效性。

    输出示例

    Creating 'Contributor' role assignment under scope '/subscriptions/<subscription_id>'
    The output includes credentials that you must protect. Be sure that you do not
    include these credentials in your code or check the credentials into your source
    control. For more information, see https://aka.ms/azadsp-cli
    {
      "appId": "ac461d78-bf4b-4387-ad16-7e32e328aec6",
      "displayName": <service_principal>",
      "password": "00000000-0000-0000-0000-000000000000",
      "tenantId": "8049c7e9-c3de-762d-a54e-dc3f6be6a7ee"
    }

  8. 记录前面输出中 appIdpassword 参数的值。OpenShift Container Platform 安装过程中需要这些值。

其他资源

8.2.5. 后续步骤

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.