你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
适用于:✔️标准体系结构
本文介绍如何使用托管标识部署具有标准体系结构群集的Azure Red Hat OpenShift。 无法将使用 服务主体 的现有群集迁移为使用托管身份。 需要创建一个在 Azure Red Hat OpenShift 标准体系结构群集中使用托管标识的新群集。
采用标准架构的 Azure Red Hat OpenShift 是一项支持托管标识和工作负载标识的托管式 OpenShift 服务。 托管标识和工作负载标识通过提供短期令牌,而不是提供长期凭据(例如具有客户端密码凭据的服务主体),帮助最大限度地降低保护工作负载和应用程序时的风险。
有关详细信息,请参见:
先决条件
如果不使用 Azure 门户,请确保使用的是 Azure CLI 版本 2.90.0 或更高版本,其中包含托管标识群集的完全支持的 CLI 参数。 用 az --version 查找你安装的 Azure CLI 版本。 如果需要进行安装或升级,请参阅安装 Azure CLI。
Azure Red Hat OpenShift 至少需要 44 个核心才能创建 OpenShift 群集。 新 Azure 订阅的默认 Azure 资源配额不符合此要求。 若要请求增加资源限制,请参阅增加 VM 系列 vCPU 配额。
44 个核心用于以下用途:
- 启动计算机:8 个内核
- 控制平面(主机):24 核
- 计算(工作机器):12 个核心
安装完成后,将删除启动计算机,群集总共使用 36 个核心。 有关详细信息,请参阅 在 Azure 上安装。
运行以下命令,检查 Azure 订阅中 Standard DSv5 虚拟机大小的配额;该大小是 CLI 或门户中的默认虚拟机大小:
LOCATION=eastus
az vm list-usage -l $LOCATION \
--query "[?contains(name.value, 'standardDSv5Family')]" -o table
验证你的权限
本文将创建一个资源组,其中包含群集的虚拟网络和托管标识。 若要创建资源组,您需要对包含该资源组或订阅拥有贡献者权限和用户访问管理员权限,或拥有所有者权限。
还必须具有足够的 Microsoft Entra 权限(即,必须是租户的成员用户,或分配了应用程序管理员角色的来宾用户),才能创建一组托管标识并分配供群集使用的角色。 有关详细信息,请参阅 成员和来宾 ,以及 向具有 Microsoft Entra ID 的用户分配管理员和非管理员角色。
注册资源提供程序
若要使用某些Azure资源提供程序(包括Azure Red Hat OpenShift资源提供程序),需要注册它们。 注册资源提供程序时,会在订阅中创建服务主体,授权资源提供程序执行某些操作,例如创建资源。 有关使用 Azure 门户注册资源提供程序的说明,或有关资源提供程序注册的详细信息,请参阅“注册资源提供程序”。
如果有多个 Azure 订阅,请指定相关订阅 ID:
az account set --subscription <SUBSCRIPTION ID>注册
Microsoft.RedHatOpenShift资源提供程序:az provider register -n Microsoft.RedHatOpenShift --wait注册
Microsoft.Compute资源提供程序:az provider register -n Microsoft.Compute --wait注册
Microsoft.Storage资源提供程序:az provider register -n Microsoft.Storage --wait注册
Microsoft.Authorization资源提供程序:az provider register -n Microsoft.Authorization --wait
获取 Red Hat 拉取密钥(可选)
Azure Red Hat OpenShift 拉取密码不会影响 Red Hat OpenShift 订阅费用。
Red Hat 拉取机密使群集能够访问 Red Hat 容器注册表和 OperatorHub 中的其他内容(例如运算符)。 此步骤是可选的,但建议执行。 如果决定稍后添加拉取机密,请按照本指南操作。 即使你的拉取机密包含该字段,字段 cloud.openshift.com 也会从你的机密中被移除。 此字段启用额外的监视功能,该功能将数据发送到 Red Hat,因此默认处于禁用状态。 若要启用此功能,请参阅 “启用远程运行状况报告”。
导航到 Red Hat OpenShift 群集管理器门户并登录。
需要登录到 Red Hat 帐户,或使用业务电子邮件创建新的 Red Hat 帐户并接受条款和条件。
选择“下载拉取机密”,保存副本以用于Azure Red Hat OpenShift群集。
将已保存的
pull-secret.txt文件保存在安全的位置。 在每次创建群集时,如果需要创建包含 Red Hat 或认证合作伙伴的示例或操作员的群集,则会使用该文件。运行
az aro create命令时,可以使用--pull-secret @pull-secret.txt参数引用拉取机密。 从存储pull-secret.txt文件的目录运行az aro create。 否则,将@pull-secret.txt替换为@/path/to/my/pull-secret.txt。如果要复制拉取机密或在其他脚本中引用它,则应将拉取机密的格式设置为有效的 JSON 字符串。
为群集准备自定义域(可选)
运行 az aro create 命令时,可以使用 --domain foo.example.com 参数为群集指定自定义域。
注释
通过 Azure CLI 创建群集时,添加域名是可选的。 通过门户添加群集时,需要提供域名,或用作 OpenShift 控制台和 API 服务器自动生成的 DNS 名称一部分的前缀。 有关详细信息,请参阅 快速入门:使用 Azure 门户部署 Azure Red Hat OpenShift 群集。
如果为群集提供自定义域,请注意以下几点:
- 创建群集后,必须在 DNS 服务器中为指定的
--domain创建 2 个 DNS A 记录:- api - 指向 API 服务器 IP 地址
- *.apps - 指向入口 IP 地址
- 通过创建群集后运行以下命令来检索这些值:
az aro show $CLUSTER -g $RESOURCEGROUP --query '{api:apiserverProfile.ip, ingress:ingressProfiles[0].ip}'
- OpenShift 控制台可以通过像
https://console-openshift-console.apps.example.com这样的 URL 访问,而不是通过内置域https://console-openshift-console.apps.<random>.<location>.aroapp.io。 - 默认情况下,OpenShift 对自定义域
*.apps.example.com上创建的所有路由使用自签名证书。 如果在连接到群集后选择使用自定义 DNS,则需要按照 OpenShift 文档为 入口控制器配置自定义 CA和为API 服务器配置自定义 CA。
使用 Azure CLI 进行安装
本部分介绍如何使用Azure CLI通过托管标识创建Azure Red Hat OpenShift群集。 有三个选项可用于使用 CLI 创建群集:
- 全自动:CLI 通过一条命令处理所需用户分配托管标识的创建、角色分配和群集创建。 仍必须预先创建网络资源。
-
部分自动化:群集创建由两部分组成:
- 标识和角色分配创建:CLI 创建所需的标识和角色分配。
- 群集创建:运行群集 create 命令,提供刚刚创建的托管标识名称(或资源 ID)。
-
手动:您创建所需的用户分配托管标识和角色分配,然后在群集创建命令中提供这些内容。
- 还可以让 CLI 输出要运行的命令,以便创建所需的标识和角色分配。
创建包含两个空子网的虚拟网络
创建包含两个空子网的虚拟网络。 如果有满足需求的现有虚拟网络,请跳过此步骤。
有关网络和要求的信息,请参阅 Azure Red Hat OpenShift 的网络。
在执行
az命令的 shell 环境中,需要设置以下变量。LOCATION=eastus # the location of your cluster RESOURCEGROUP=aro-rg # the name of the resource group where you want to create your cluster CLUSTER=cluster # the name of your cluster创建资源组。
Azure 资源组是用于部署和管理 Azure 资源的逻辑组。 创建资源组时,系统会要求你指定一个位置。 此位置是存储资源组元数据的位置,如果在创建资源期间未指定其他区域,则资源在 Azure 中运行的位置。 使用 az group create 命令创建资源组。
注释
Azure Red Hat OpenShift 在可以创建 Azure 资源组的所有区域中都不可用。 有关支持 Azure Red Hat OpenShift 的位置的信息,请参阅可用区域。
az group create \ --location $LOCATION \ --name $RESOURCEGROUP在以前创建的同一资源组中创建虚拟网络、主节点子网和工作子网。
Azure Red Hat OpenShift 群集需要一个虚拟网络,其中包含主节点和工作节点的两个空子网。 可以创建新的虚拟网络,也可以使用现有的虚拟网络。
az network vnet create \ --resource-group $RESOURCEGROUP \ --name aro-vnet \ --address-prefixes 10.0.0.0/22az network vnet subnet create \ --resource-group $RESOURCEGROUP \ --vnet-name aro-vnet \ --name master \ --address-prefixes 10.0.0.0/23az network vnet subnet create \ --resource-group $RESOURCEGROUP \ --vnet-name aro-vnet \ --name worker \ --address-prefixes 10.0.2.0/23
创建方法
全自动
若要使用完全自动化的方法创建群集,请运行以下命令以添加 --enable-managed-identity 参数。 此命令还会创建所需的用户分配的托管标识和角色分配。 若要添加拉取机密或使用自定义域,请参阅 “创建群集”。
az aro create \
--resource-group $RESOURCEGROUP \
--name $CLUSTER \
--vnet aro-vnet \
--master-subnet master \
--worker-subnet worker \
--version <VERSION> \
--enable-managed-identity
群集创建开始。 如果要使用特定的 OpenShift 版本,请参阅“选择其他Azure Red Hat OpenShift版本。 群集准备就绪后,请参阅 “清理 ”,了解如何将其删除。
部分自动化
若要仅创建所需的用户分配的托管标识和角色分配,请运行以下命令:
az aro identity create-required \
--resource-group $RESOURCEGROUP \
--location $LOCATION \
--vnet aro-vnet \
--master-subnet master \
--worker-subnet worker \
--version <VERSION>
命令完成后,可以看到创建的每个托管标识的详细信息。
Example:
[
{
"clientId": "22222222-2222-2222-2222-222222222222",
"id": "/subscriptions/<SUBSCRIPTION>/resourcegroups/<RESOURCEGROUP>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/aro-cluster",
"isolationScope": "None",
"location": "westus3",
"name": "aro-cluster",
"principalId": "33333333-3333-3333-3333-333333333333",
"resourceGroup": "<RESOURCEGROUP>",
"tags": {},
"tenantId": "11111111-1111-1111-1111-111111111111",
"type": "Microsoft.ManagedIdentity/userAssignedIdentities"
},
[...]
继续使用“ 创建群集 ”命令中上一命令返回的标识名称或资源 ID。
Manual
独立创建所需的用户分配的托管标识和角色分配,然后 创建群集。
创建所需的用户分配的托管标识。 Azure Red Hat OpenShift需要 9 个托管标识,每个托管标识都需要分配的内置角色:
- 与核心 OpenShift Operator 相关的七个托管标识。
- 一个用于 Azure Red Hat OpenShift 服务 Operator 的托管标识。
- 另一个用于群集的标识,以启用这些标识。
托管标识组件包括:
- OpenShift 映像注册表 Operator (image-registry)
- OpenShift 网络 Operator (cloud-network-config)
- OpenShift 磁盘存储 Operator (disk-csi-driver)
- OpenShift 文件存储 Operator (file-csi-driver)
- OpenShift 群集入口 Operator (ingress)
- OpenShift 云控制器管理器 (cloud-controller-manager)
- OpenShift 机器 API Operator (machine-api)
- Azure Red Hat OpenShift 服务 Operator (aro-operator)
有八个不同的托管标识和相应的内置角色,这些角色表示 Azure Red Hat OpenShift 的每个组件执行其职责所需的权限。 此外,平台需要另一个标识(群集标识),以便为之前提到的托管身份组件(aro-cluster)进行联合凭证的创建。
有关 Red Hat OpenShift 群集作员的详细信息,请参阅 群集作员参考。
有关 Azure Red Hat OpenShift 中的托管标识的详细信息,请参阅 了解 Azure Red Hat OpenShift 中的托管标识。
注释
还可以使用
az aro identity get-requiredCLI 获取标识创建和角色分配命令。创建所需的标识:
az identity create \ --resource-group $RESOURCEGROUP \ --name aro-clusteraz identity create \ --resource-group $RESOURCEGROUP \ --name cloud-controller-manageraz identity create \ --resource-group $RESOURCEGROUP \ --name ingressaz identity create \ --resource-group $RESOURCEGROUP \ --name machine-apiaz identity create \ --resource-group $RESOURCEGROUP \ --name disk-csi-driveraz identity create \ --resource-group $RESOURCEGROUP \ --name cloud-network-configaz identity create \ --resource-group $RESOURCEGROUP \ --name image-registryaz identity create \ --resource-group $RESOURCEGROUP \ --name file-csi-driveraz identity create \ --resource-group $RESOURCEGROUP \ --name aro-operator为每个 Operator 标识、群集标识和第一方服务主体创建所需的角色分配。
注释
本文假定只有主节点子网和工作节点子网存在。 如果在安装时配置了更多群集子网,则需要为需要该子网的作员授予角色分配范围。
以下主节点子网和工作节点子网的角色分配假定未附加网络安全组 (NSG)、路由表或网络地址转换 (NAT) 网关。 如果将其中任何一个网络资源引入安装,则需要创建更多角色分配,以便为这些额外的网络资源授予作员标识权限。 对于需要为以下子网或虚拟网络分配角色的每个操作员,还需要为额外的网络资源分配角色。
SUBSCRIPTION_ID=$(az account show --query 'id' -o tsv) # assign cluster identity permissions over the identities az role assignment create \ --assignee-object-id "$(az identity show --resource-group $RESOURCEGROUP --name aro-cluster --query principalId -o tsv)" \ --assignee-principal-type ServicePrincipal \ --role "/subscriptions/$SUBSCRIPTION_ID/providers/Microsoft.Authorization/roleDefinitions/ef318e2a-8334-4a05-9e4a-295a196c6a6e" \ --scope "/subscriptions/$SUBSCRIPTION_ID/resourcegroups/$RESOURCEGROUP/providers/Microsoft.ManagedIdentity/userAssignedIdentities/aro-operator" az role assignment create \ --assignee-object-id "$(az identity show --resource-group $RESOURCEGROUP --name aro-cluster --query principalId -o tsv)" \ --assignee-principal-type ServicePrincipal \ --role "/subscriptions/$SUBSCRIPTION_ID/providers/Microsoft.Authorization/roleDefinitions/ef318e2a-8334-4a05-9e4a-295a196c6a6e" \ --scope "/subscriptions/$SUBSCRIPTION_ID/resourcegroups/$RESOURCEGROUP/providers/Microsoft.ManagedIdentity/userAssignedIdentities/cloud-controller-manager" az role assignment create \ --assignee-object-id "$(az identity show --resource-group $RESOURCEGROUP --name aro-cluster --query principalId -o tsv)" \ --assignee-principal-type ServicePrincipal \ --role "/subscriptions/$SUBSCRIPTION_ID/providers/Microsoft.Authorization/roleDefinitions/ef318e2a-8334-4a05-9e4a-295a196c6a6e" \ --scope "/subscriptions/$SUBSCRIPTION_ID/resourcegroups/$RESOURCEGROUP/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ingress" az role assignment create \ --assignee-object-id "$(az identity show --resource-group $RESOURCEGROUP --name aro-cluster --query principalId -o tsv)" \ --assignee-principal-type ServicePrincipal \ --role "/subscriptions/$SUBSCRIPTION_ID/providers/Microsoft.Authorization/roleDefinitions/ef318e2a-8334-4a05-9e4a-295a196c6a6e" \ --scope "/subscriptions/$SUBSCRIPTION_ID/resourcegroups/$RESOURCEGROUP/providers/Microsoft.ManagedIdentity/userAssignedIdentities/machine-api" az role assignment create \ --assignee-object-id "$(az identity show --resource-group $RESOURCEGROUP --name aro-cluster --query principalId -o tsv)" \ --assignee-principal-type ServicePrincipal \ --role "/subscriptions/$SUBSCRIPTION_ID/providers/Microsoft.Authorization/roleDefinitions/ef318e2a-8334-4a05-9e4a-295a196c6a6e" \ --scope "/subscriptions/$SUBSCRIPTION_ID/resourcegroups/$RESOURCEGROUP/providers/Microsoft.ManagedIdentity/userAssignedIdentities/disk-csi-driver" az role assignment create \ --assignee-object-id "$(az identity show --resource-group $RESOURCEGROUP --name aro-cluster --query principalId -o tsv)" \ --assignee-principal-type ServicePrincipal \ --role "/subscriptions/$SUBSCRIPTION_ID/providers/Microsoft.Authorization/roleDefinitions/ef318e2a-8334-4a05-9e4a-295a196c6a6e" \ --scope "/subscriptions/$SUBSCRIPTION_ID/resourcegroups/$RESOURCEGROUP/providers/Microsoft.ManagedIdentity/userAssignedIdentities/cloud-network-config" az role assignment create \ --assignee-object-id "$(az identity show --resource-group $RESOURCEGROUP --name aro-cluster --query principalId -o tsv)" \ --assignee-principal-type ServicePrincipal \ --role "/subscriptions/$SUBSCRIPTION_ID/providers/Microsoft.Authorization/roleDefinitions/ef318e2a-8334-4a05-9e4a-295a196c6a6e" \ --scope "/subscriptions/$SUBSCRIPTION_ID/resourcegroups/$RESOURCEGROUP/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-registry" az role assignment create \ --assignee-object-id "$(az identity show --resource-group $RESOURCEGROUP --name aro-cluster --query principalId -o tsv)" \ --assignee-principal-type ServicePrincipal \ --role "/subscriptions/$SUBSCRIPTION_ID/providers/Microsoft.Authorization/roleDefinitions/ef318e2a-8334-4a05-9e4a-295a196c6a6e" \ --scope "/subscriptions/$SUBSCRIPTION_ID/resourcegroups/$RESOURCEGROUP/providers/Microsoft.ManagedIdentity/userAssignedIdentities/file-csi-driver" # assign vnet-level permissions for operators that require it, and subnets-level permission for operators that require it az role assignment create \ --assignee-object-id "$(az identity show --resource-group $RESOURCEGROUP --name cloud-controller-manager --query principalId -o tsv)" \ --assignee-principal-type ServicePrincipal \ --role "/subscriptions/$SUBSCRIPTION_ID/providers/Microsoft.Authorization/roleDefinitions/a1f96423-95ce-4224-ab27-4e3dc72facd4" \ --scope "/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCEGROUP/providers/Microsoft.Network/virtualNetworks/aro-vnet/subnets/master" az role assignment create \ --assignee-object-id "$(az identity show --resource-group $RESOURCEGROUP --name cloud-controller-manager --query principalId -o tsv)" \ --assignee-principal-type ServicePrincipal \ --role "/subscriptions/$SUBSCRIPTION_ID/providers/Microsoft.Authorization/roleDefinitions/a1f96423-95ce-4224-ab27-4e3dc72facd4" \ --scope "/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCEGROUP/providers/Microsoft.Network/virtualNetworks/aro-vnet/subnets/worker" az role assignment create \ --assignee-object-id "$(az identity show --resource-group $RESOURCEGROUP --name ingress --query principalId -o tsv)" \ --assignee-principal-type ServicePrincipal \ --role "/subscriptions/$SUBSCRIPTION_ID/providers/Microsoft.Authorization/roleDefinitions/0336e1d3-7a87-462b-b6db-342b63f7802c" \ --scope "/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCEGROUP/providers/Microsoft.Network/virtualNetworks/aro-vnet/subnets/master" az role assignment create \ --assignee-object-id "$(az identity show --resource-group $RESOURCEGROUP --name ingress --query principalId -o tsv)" \ --assignee-principal-type ServicePrincipal \ --role "/subscriptions/$SUBSCRIPTION_ID/providers/Microsoft.Authorization/roleDefinitions/0336e1d3-7a87-462b-b6db-342b63f7802c" \ --scope "/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCEGROUP/providers/Microsoft.Network/virtualNetworks/aro-vnet/subnets/worker" az role assignment create \ --assignee-object-id "$(az identity show --resource-group $RESOURCEGROUP --name machine-api --query principalId -o tsv)" \ --assignee-principal-type ServicePrincipal \ --role "/subscriptions/$SUBSCRIPTION_ID/providers/Microsoft.Authorization/roleDefinitions/0358943c-7e01-48ba-8889-02cc51d78637" \ --scope "/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCEGROUP/providers/Microsoft.Network/virtualNetworks/aro-vnet/subnets/master" az role assignment create \ --assignee-object-id "$(az identity show --resource-group $RESOURCEGROUP --name machine-api --query principalId -o tsv)" \ --assignee-principal-type ServicePrincipal \ --role "/subscriptions/$SUBSCRIPTION_ID/providers/Microsoft.Authorization/roleDefinitions/0358943c-7e01-48ba-8889-02cc51d78637" \ --scope "/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCEGROUP/providers/Microsoft.Network/virtualNetworks/aro-vnet/subnets/worker" az role assignment create \ --assignee-object-id "$(az identity show --resource-group $RESOURCEGROUP --name cloud-network-config --query principalId -o tsv)" \ --assignee-principal-type ServicePrincipal \ --role "/subscriptions/$SUBSCRIPTION_ID/providers/Microsoft.Authorization/roleDefinitions/be7a6435-15ae-4171-8f30-4a343eff9e8f" \ --scope "/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCEGROUP/providers/Microsoft.Network/virtualNetworks/aro-vnet" az role assignment create \ --assignee-object-id "$(az identity show --resource-group $RESOURCEGROUP --name file-csi-driver --query principalId -o tsv)" \ --assignee-principal-type ServicePrincipal \ --role "/subscriptions/$SUBSCRIPTION_ID/providers/Microsoft.Authorization/roleDefinitions/0d7aedc0-15fd-4a67-a412-efad370c947e" \ --scope "/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCEGROUP/providers/Microsoft.Network/virtualNetworks/aro-vnet" az role assignment create \ --assignee-object-id "$(az identity show --resource-group $RESOURCEGROUP --name image-registry --query principalId -o tsv)" \ --assignee-principal-type ServicePrincipal \ --role "/subscriptions/$SUBSCRIPTION_ID/providers/Microsoft.Authorization/roleDefinitions/8b32b316-c2f5-4ddf-b05b-83dacd2d08b5" \ --scope "/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCEGROUP/providers/Microsoft.Network/virtualNetworks/aro-vnet" az role assignment create \ --assignee-object-id "$(az identity show --resource-group $RESOURCEGROUP --name aro-operator --query principalId -o tsv)" \ --assignee-principal-type ServicePrincipal \ --role "/subscriptions/$SUBSCRIPTION_ID/providers/Microsoft.Authorization/roleDefinitions/4436bae4-7702-4c84-919b-c4069ff25ee2" \ --scope "/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCEGROUP/providers/Microsoft.Network/virtualNetworks/aro-vnet/subnets/master" az role assignment create \ --assignee-object-id "$(az identity show --resource-group $RESOURCEGROUP --name aro-operator --query principalId -o tsv)" \ --assignee-principal-type ServicePrincipal \ --role "/subscriptions/$SUBSCRIPTION_ID/providers/Microsoft.Authorization/roleDefinitions/4436bae4-7702-4c84-919b-c4069ff25ee2" \ --scope "/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCEGROUP/providers/Microsoft.Network/virtualNetworks/aro-vnet/subnets/worker" az role assignment create \ --assignee-object-id "$(az ad sp list --display-name "Azure Red Hat OpenShift RP" --query '[0].id' -o tsv)" \ --assignee-principal-type ServicePrincipal \ --role "/subscriptions/$SUBSCRIPTION_ID/providers/Microsoft.Authorization/roleDefinitions/42f3c60f-e7b1-46d7-ba56-6de681664342" \ --scope "/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCEGROUP/providers/Microsoft.Network/virtualNetworks/aro-vnet"
创建群集
若要创建群集,请运行以下命令,这些命令显示在选项下。 如果选择使用以下任一选项,请相应地修改命令:
- 选项 1: 传递 Red Hat 拉取机密,使群集能够访问 Red Hat 容器注册表以及其他内容。 将
--pull-secret @pull-secret.txt参数添加到命令中。 - 选项 2: 使用自定义域。 将
--domain foo.example.com参数添加到命令中,将foo.example.com替换为你自己的自定义域。
使用所需的环境变量创建群集。 对于每个 --assign-platform-workload-identity 标志,第一个参数表示键,该键指示 Azure Red Hat OpenShift 资源提供程序为给定标识使用哪个 OpenShift Operator。 第二个参数表示对该标识本身的引用。
az aro create \
--resource-group $RESOURCEGROUP \
--name $CLUSTER \
--vnet aro-vnet \
--master-subnet master \
--worker-subnet worker \
--version <VERSION> \
--enable-managed-identity \
--assign-cluster-identity aro-cluster \
--assign-platform-workload-identity file-csi-driver file-csi-driver \
--assign-platform-workload-identity cloud-controller-manager cloud-controller-manager \
--assign-platform-workload-identity ingress ingress \
--assign-platform-workload-identity image-registry image-registry \
--assign-platform-workload-identity machine-api machine-api \
--assign-platform-workload-identity cloud-network-config cloud-network-config \
--assign-platform-workload-identity aro-operator aro-operator \
--assign-platform-workload-identity disk-csi-driver disk-csi-driver
作为一个选项,如果标识资源存在于其他 区域 或 资源组中,则可以传递要创建的完整资源 ID。 请参阅以下示例:
az aro create \
--resource-group $RESOURCEGROUP \
--name $CLUSTER \
--vnet aro-vnet \
--master-subnet master \
--worker-subnet worker \
--version <VERSION> \
--enable-managed-identity \
--assign-cluster-identity /subscriptions/$SUBSCRIPTION_ID/resourcegroups/$RESOURCEGROUP/providers/Microsoft.ManagedIdentity/userAssignedIdentities/aro-cluster \
--assign-platform-workload-identity file-csi-driver /subscriptions/$SUBSCRIPTION_ID/resourcegroups/$RESOURCEGROUP/providers/Microsoft.ManagedIdentity/userAssignedIdentities/file-csi-driver \
--assign-platform-workload-identity cloud-controller-manager /subscriptions/$SUBSCRIPTION_ID/resourcegroups/$RESOURCEGROUP/providers/Microsoft.ManagedIdentity/userAssignedIdentities/cloud-controller-manager \
--assign-platform-workload-identity ingress /subscriptions/$SUBSCRIPTION_ID/resourcegroups/$RESOURCEGROUP/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ingress \
--assign-platform-workload-identity image-registry /subscriptions/$SUBSCRIPTION_ID/resourcegroups/$RESOURCEGROUP/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-registry \
--assign-platform-workload-identity machine-api /subscriptions/$SUBSCRIPTION_ID/resourcegroups/$RESOURCEGROUP/providers/Microsoft.ManagedIdentity/userAssignedIdentities/machine-api \
--assign-platform-workload-identity cloud-network-config /subscriptions/$SUBSCRIPTION_ID/resourcegroups/$RESOURCEGROUP/providers/Microsoft.ManagedIdentity/userAssignedIdentities/cloud-network-config \
--assign-platform-workload-identity aro-operator /subscriptions/$SUBSCRIPTION_ID/resourcegroups/$RESOURCEGROUP/providers/Microsoft.ManagedIdentity/userAssignedIdentities/aro-operator \
--assign-platform-workload-identity disk-csi-driver /subscriptions/$SUBSCRIPTION_ID/resourcegroups/$RESOURCEGROUP/providers/Microsoft.ManagedIdentity/userAssignedIdentities/disk-csi-driver
选择其他 Azure Red Hat OpenShift 版本
创建群集时,可以选择使用特定版本的 Azure Red Hat OpenShift。 首先,使用 CLI 查询可用的 Azure Red Hat OpenShift 版本:
az aro get-versions --location <REGION>
选择版本后,使用 --version 命令中的 az aro create 参数指定它。
使用 Bicep 进行安装
本部分介绍如何使用 Bicep 创建具有托管标识的 Azure Red Hat OpenShift 群集。
将 示例 Bicep 文件 保存到文件中。 对于此示例,请将其另存为 azuredeploy.bicep。
在计划执行
az命令的 shell 环境中设置以下变量。LOCATION=eastus # the location of your cluster RESOURCEGROUP=aro-rg # the name of the resource group where you want to create your cluster CLUSTER=cluster # the name of your cluster VERSION=4.21.22 # the version of the cluster PULL_SECRET=$(cat pull-secret.txt) # the Red Hat pull secret JSON, provided as file or string创建一个资源组来保存群集资源和群集虚拟网络和标识。
az group create --name $RESOURCEGROUP --location $LOCATION对于资源提供程序,请检查订阅的第一方服务主体对象 ID。
ARO_RP_SP_OBJECT_ID=$(az ad sp list --display-name "Azure Red Hat OpenShift RP" --query '[0].id' -o tsv)部署 Bicep 文件:
az deployment group create \ --name aroDeployment \ --resource-group $RESOURCEGROUP \ --template-file azuredeploy.bicep \ --parameters location=$LOCATION \ --parameters version=$VERSION \ --parameters clusterName=$CLUSTER \ --parameters rpObjectId=$ARO_RP_SP_OBJECT_ID如果使用了拉取机密或自定义域的可选参数,请在
\参数后面添加一个行继续反斜杠(rpObjectId),并将以下参数包括在部署命令中:--parameters domain=$DOMAIN \ #optional --parameters pullSecret=$PULL_SECRET # optional
示例 Bicep 文件
注释
本文假定只有主节点子网和工作节点子网存在。 如果在安装时配置了更多群集子网,则需要为需要该子网的作员授予角色分配范围。
以下主节点子网和工作节点子网的角色分配假定未附加网络安全组 (NSG)、路由表或网络地址转换 (NAT) 网关。 如果将其中任何一个网络资源引入安装,则需要创建更多角色分配,以便为这些额外的网络资源授予作员标识权限。 对于需要为以下子网或虚拟网络分配角色的每个操作员,还需要为额外的网络资源分配角色。
@description('Location')
param location string = resourceGroup().location
@description('Domain Prefix')
param domain string
@description('Version of the OpenShift cluster')
param version string
@description('Pull secret from cloud.redhat.com. The json should be input as a string')
@secure()
param pullSecret string = ''
@description('Name of vNet')
param clusterVnetName string = 'aro-vnet'
@description('vNet Address Space')
param clusterVnetCidr string = '10.100.0.0/15'
@description('Worker node subnet address space')
param workerSubnetCidr string = '10.100.70.0/23'
@description('Master node subnet address space')
param masterSubnetCidr string = '10.100.76.0/24'
@description('Master Node VM Type')
param masterVmSize string = 'Standard_D8s_v3'
@description('Worker Node VM Type')
param workerVmSize string = 'Standard_D4s_v3'
@description('Worker Node Disk Size in GB')
@minValue(128)
param workerVmDiskSize int = 128
@description('Cidr for Pods')
param podCidr string = '10.128.0.0/14'
@metadata({
description: 'Cidr of service'
})
param serviceCidr string = '172.30.0.0/16'
@description('Unique name for the cluster')
param clusterName string
@description('Api Server Visibility')
@allowed([
'Private'
'Public'
])
param apiServerVisibility string = 'Public'
@description('Ingress Visibility')
@allowed([
'Private'
'Public'
])
param ingressVisibility string = 'Public'
@description('The ObjectID of the Resource Provider Service Principal')
param rpObjectId string
@description('Specify if FIPS validated crypto modules are used')
@allowed([
'Enabled'
'Disabled'
])
param fips string = 'Disabled'
@description('Specify if master VMs are encrypted at host')
@allowed([
'Enabled'
'Disabled'
])
param masterEncryptionAtHost string = 'Disabled'
@description('Specify if worker VMs are encrypted at host')
@allowed([
'Enabled'
'Disabled'
])
param workerEncryptionAtHost string = 'Disabled'
var resourceGroupId = '/subscriptions/${subscription().subscriptionId}/resourceGroups/aro-${domain}-${location}'
var masterSubnetId=resourceId('Microsoft.Network/virtualNetworks/subnets', clusterVnetName, 'master')
var workerSubnetId=resourceId('Microsoft.Network/virtualNetworks/subnets', clusterVnetName, 'worker')
resource vnet 'Microsoft.Network/virtualNetworks@2023-06-01' = {
name: clusterVnetName
location: location
properties: {
addressSpace: { addressPrefixes: [ clusterVnetCidr ] }
subnets: [
{
name: 'master'
properties: {
addressPrefixes: [ masterSubnetCidr ]
serviceEndpoints: [ { service: 'Microsoft.ContainerRegistry' } ]
}
}
{
name: 'worker'
properties: {
addressPrefixes: [ workerSubnetCidr ]
serviceEndpoints: [ { service: 'Microsoft.ContainerRegistry' } ]
}
}
]
}
}
resource workerSubnet 'Microsoft.Network/virtualNetworks/subnets@2020-08-01' existing = {
parent: vnet
name: 'worker'
}
resource masterSubnet 'Microsoft.Network/virtualNetworks/subnets@2020-08-01' existing = {
parent: vnet
name: 'master'
}
// create required identities
resource cloudControllerManager 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = {
name: 'cloud-controller-manager'
location: location
}
resource ingress 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = {
name: 'ingress'
location: location
}
resource machineApi 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = {
name: 'machine-api'
location: location
}
resource diskCsiDriver 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = {
name: 'disk-csi-driver'
location: location
}
resource cloudNetworkConfig 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = {
name: 'cloud-network-config'
location: location
}
resource imageRegistry 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = {
name: 'image-registry'
location: location
}
resource fileCsiDriver 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = {
name: 'file-csi-driver'
location: location
}
resource aroOperator 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = {
name: 'aro-operator'
location: location
}
resource clusterMsi 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = {
name: 'cluster'
location: location
}
// create required role assignments on vnet / subnets
resource cloudControllerManagerMasterSubnetRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(masterSubnet.id, 'cloud-controller-manager')
scope: masterSubnet
properties: {
principalId: cloudControllerManager.properties.principalId
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'a1f96423-95ce-4224-ab27-4e3dc72facd4')
principalType: 'ServicePrincipal'
}
}
resource cloudControllerManagerWorkerSubnetRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(workerSubnet.id, 'cloud-controller-manager')
scope: workerSubnet
properties: {
principalId: cloudControllerManager.properties.principalId
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'a1f96423-95ce-4224-ab27-4e3dc72facd4')
principalType: 'ServicePrincipal'
}
}
resource ingressMasterSubnetRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(masterSubnet.id, 'ingress')
scope: masterSubnet
properties: {
principalId: ingress.properties.principalId
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0336e1d3-7a87-462b-b6db-342b63f7802c')
principalType: 'ServicePrincipal'
}
}
resource ingressWorkerSubnetRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(workerSubnet.id, 'ingress')
scope: workerSubnet
properties: {
principalId: ingress.properties.principalId
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0336e1d3-7a87-462b-b6db-342b63f7802c')
principalType: 'ServicePrincipal'
}
}
resource machineApiMasterSubnetRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(masterSubnet.id, 'machine-api')
scope: masterSubnet
properties: {
principalId: machineApi.properties.principalId
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0358943c-7e01-48ba-8889-02cc51d78637')
principalType: 'ServicePrincipal'
}
}
resource machineApiWorkerSubnetRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(workerSubnet.id, 'machine-api')
scope: workerSubnet
properties: {
principalId: machineApi.properties.principalId
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0358943c-7e01-48ba-8889-02cc51d78637')
principalType: 'ServicePrincipal'
}
}
resource cloudNetworkConfigVnetRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(vnet.id, 'cloud-network-config')
scope: vnet
properties: {
principalId: cloudNetworkConfig.properties.principalId
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'be7a6435-15ae-4171-8f30-4a343eff9e8f')
principalType: 'ServicePrincipal'
}
}
resource fileCsiDriverVnetRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(vnet.id, 'file-csi-driver')
scope: vnet
properties: {
principalId: fileCsiDriver.properties.principalId
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0d7aedc0-15fd-4a67-a412-efad370c947e')
principalType: 'ServicePrincipal'
}
}
resource imageRegistryVnetRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(vnet.id, 'image-registry')
scope: vnet
properties: {
principalId: imageRegistry.properties.principalId
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '8b32b316-c2f5-4ddf-b05b-83dacd2d08b5')
principalType: 'ServicePrincipal'
}
}
resource aroOperatorMasterSubnetRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(masterSubnet.id, 'aro-operator')
scope: masterSubnet
properties: {
principalId: aroOperator.properties.principalId
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '4436bae4-7702-4c84-919b-c4069ff25ee2')
principalType: 'ServicePrincipal'
}
}
resource aroOperatorWorkerSubnetRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(workerSubnet.id, 'aro-operator')
scope: workerSubnet
properties: {
principalId: aroOperator.properties.principalId
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '4436bae4-7702-4c84-919b-c4069ff25ee2')
principalType: 'ServicePrincipal'
}
}
// create required role assignments on cluster MSI
resource clusterMsiRoleAssignmentCloudControllerManager 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(cloudControllerManager.id, 'cluster')
scope: cloudControllerManager
properties: {
principalId: clusterMsi.properties.principalId
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ef318e2a-8334-4a05-9e4a-295a196c6a6e')
principalType: 'ServicePrincipal'
}
}
resource clusterMsiRoleAssignmentIngress 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(ingress.id, 'cluster')
scope: ingress
properties: {
principalId: clusterMsi.properties.principalId
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ef318e2a-8334-4a05-9e4a-295a196c6a6e')
principalType: 'ServicePrincipal'
}
}
resource clusterMsiRoleAssignmentMachineApi 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(machineApi.id, 'cluster')
scope: machineApi
properties: {
principalId: clusterMsi.properties.principalId
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ef318e2a-8334-4a05-9e4a-295a196c6a6e')
principalType: 'ServicePrincipal'
}
}
resource clusterMsiRoleAssignmentDiskCsiDriver 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(diskCsiDriver.id, 'cluster')
scope: diskCsiDriver
properties: {
principalId: clusterMsi.properties.principalId
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ef318e2a-8334-4a05-9e4a-295a196c6a6e')
principalType: 'ServicePrincipal'
}
}
resource clusterMsiRoleAssignmentCloudNetworkConfig 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(cloudNetworkConfig.id, 'cluster')
scope: cloudNetworkConfig
properties: {
principalId: clusterMsi.properties.principalId
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ef318e2a-8334-4a05-9e4a-295a196c6a6e')
principalType: 'ServicePrincipal'
}
}
resource clusterMsiRoleAssignmentCloudImageRegistry 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(imageRegistry.id, 'cluster')
scope: imageRegistry
properties: {
principalId: clusterMsi.properties.principalId
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ef318e2a-8334-4a05-9e4a-295a196c6a6e')
principalType: 'ServicePrincipal'
}
}
resource clusterMsiRoleAssignmentCloudFileCsiDriver 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(fileCsiDriver.id, 'cluster')
scope: fileCsiDriver
properties: {
principalId: clusterMsi.properties.principalId
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ef318e2a-8334-4a05-9e4a-295a196c6a6e')
principalType: 'ServicePrincipal'
}
}
resource clusterMsiRoleAssignmentCloudAroOperator 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(aroOperator.id, 'cluster')
scope: aroOperator
properties: {
principalId: clusterMsi.properties.principalId
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ef318e2a-8334-4a05-9e4a-295a196c6a6e')
principalType: 'ServicePrincipal'
}
}
// create first party role assignment over the vnet
resource fpspRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(vnet.id, rpObjectId)
scope: vnet
properties: {
principalId: rpObjectId
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '42f3c60f-e7b1-46d7-ba56-6de681664342')
principalType: 'ServicePrincipal'
}
}
// create cluster
resource cluster 'Microsoft.RedHatOpenShift/openShiftClusters@2025-07-25' = {
name: clusterName
location: location
properties: {
clusterProfile: {
domain: domain
#disable-next-line use-resource-id-functions
resourceGroupId: resourceGroupId
version: version
fipsValidatedModules: fips
pullSecret: pullSecret
}
networkProfile: {podCidr: podCidr, serviceCidr: serviceCidr}
masterProfile: {
vmSize: masterVmSize
subnetId: masterSubnetId
encryptionAtHost: masterEncryptionAtHost
}
workerProfiles: [{
name: 'worker'
count: 3
diskSizeGB: workerVmDiskSize
vmSize: workerVmSize
subnetId: workerSubnetId
encryptionAtHost: workerEncryptionAtHost
}]
apiserverProfile: {visibility: apiServerVisibility}
ingressProfiles: [{name: 'default', visibility: ingressVisibility}]
platformWorkloadIdentityProfile: {
platformWorkloadIdentities: {
'cloud-controller-manager': {resourceId: cloudControllerManager.id}
ingress: {resourceId: ingress.id}
'machine-api': {resourceId: machineApi.id}
'disk-csi-driver': {resourceId: diskCsiDriver.id}
'cloud-network-config': {resourceId: cloudNetworkConfig.id}
'image-registry': {resourceId: imageRegistry.id}
'file-csi-driver': {resourceId: fileCsiDriver.id}
'aro-operator': {resourceId: aroOperator.id}
}
}
}
identity: {
type: 'UserAssigned'
userAssignedIdentities: {
'${clusterMsi.id}': {}
}
}
}
使用 ARM 模板进行安装
本部分介绍如何使用 ARM 模板创建具有托管标识的 Azure Red Hat OpenShift 群集。
将 示例 ARM 模板 保存到文件中。 在此示例中,将文件命名 为azuredeploy.json。
在计划执行
az命令的 shell 环境中设置以下变量。LOCATION=eastus # the location of your cluster RESOURCEGROUP=aro-rg # the name of the resource group where you want to create your cluster CLUSTER=cluster # the name of your cluster VERSION=4.21.22 # the version of the cluster PULL_SECRET=$(cat pull-secret.txt) # the Red Hat pull secret JSON, provided as file or string创建一个资源组来保存群集资源和群集虚拟网络和标识。
az group create --name $RESOURCEGROUP --location $LOCATION对于资源提供程序,请检查订阅的第一方服务主体对象 ID。
ARO_RP_SP_OBJECT_ID=$(az ad sp list --display-name "Azure Red Hat OpenShift RP" --query '[0].id' -o tsv)部署 ARM 模板:
az deployment group create \ --name aroDeployment \ --resource-group $RESOURCEGROUP \ --template-file azuredeploy.json \ --parameters location=$LOCATION \ --parameters version=$VERSION \ --parameters clusterName=$CLUSTER \ --parameters rpObjectId=$ARO_RP_SP_OBJECT_ID如果使用了拉取机密或自定义域的可选参数,请在
\参数后面添加一个行继续反斜杠(rpObjectId),并将以下参数包括在部署命令中:--parameters domain=$DOMAIN \ #optional --parameters pullSecret=$PULL_SECRET # optional
ARM 模板示例
注释
本文假定只有主节点子网和工作节点子网存在。 如果在安装时配置了更多群集子网,则需要为需要该子网的作员授予角色分配范围。
以下主节点子网和工作节点子网的角色分配假定未附加网络安全组 (NSG)、路由表或网络地址转换 (NAT) 网关。 如果将其中任何一个网络资源引入安装,则需要创建更多角色分配,以便为这些额外的网络资源授予作员标识权限。 对于需要为以下子网或虚拟网络分配角色的每个操作员,还需要为额外的网络资源分配角色。
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.38.33.27573",
"templateHash": "9848565761041118745"
}
},
"parameters": {
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location"
}
},
"domain": {
"type": "string",
"metadata": {
"description": "Domain Prefix"
}
},
"version": {
"type": "string",
"metadata": {
"description": "Version of the OpenShift cluster"
}
},
"pullSecret": {
"type": "securestring",
"defaultValue": "",
"metadata": {
"description": "Pull secret from cloud.redhat.com. The json should be input as a string"
}
},
"clusterVnetName": {
"type": "string",
"defaultValue": "aro-vnet",
"metadata": {
"description": "Name of vNet"
}
},
"clusterVnetCidr": {
"type": "string",
"defaultValue": "10.100.0.0/15",
"metadata": {
"description": "vNet Address Space"
}
},
"workerSubnetCidr": {
"type": "string",
"defaultValue": "10.100.70.0/23",
"metadata": {
"description": "Worker node subnet address space"
}
},
"masterSubnetCidr": {
"type": "string",
"defaultValue": "10.100.76.0/24",
"metadata": {
"description": "Master node subnet address space"
}
},
"masterVmSize": {
"type": "string",
"defaultValue": "Standard_D8s_v3",
"metadata": {
"description": "Master Node VM Type"
}
},
"workerVmSize": {
"type": "string",
"defaultValue": "Standard_D4s_v3",
"metadata": {
"description": "Worker Node VM Type"
}
},
"workerVmDiskSize": {
"type": "int",
"defaultValue": 128,
"minValue": 128,
"metadata": {
"description": "Worker Node Disk Size in GB"
}
},
"podCidr": {
"type": "string",
"defaultValue": "10.128.0.0/14",
"metadata": {
"description": "Cidr for Pods"
}
},
"serviceCidr": {
"type": "string",
"defaultValue": "172.30.0.0/16",
"metadata": {
"description": "Cidr of service"
}
},
"clusterName": {
"type": "string",
"metadata": {
"description": "Unique name for the cluster"
}
},
"apiServerVisibility": {
"type": "string",
"defaultValue": "Public",
"allowedValues": [
"Private",
"Public"
],
"metadata": {
"description": "Api Server Visibility"
}
},
"ingressVisibility": {
"type": "string",
"defaultValue": "Public",
"allowedValues": [
"Private",
"Public"
],
"metadata": {
"description": "Ingress Visibility"
}
},
"rpObjectId": {
"type": "string",
"metadata": {
"description": "The ObjectID of the Resource Provider Service Principal"
}
},
"fips": {
"type": "string",
"defaultValue": "Disabled",
"allowedValues": [
"Enabled",
"Disabled"
],
"metadata": {
"description": "Specify if FIPS validated crypto modules are used"
}
},
"masterEncryptionAtHost": {
"type": "string",
"defaultValue": "Disabled",
"allowedValues": [
"Enabled",
"Disabled"
],
"metadata": {
"description": "Specify if master VMs are encrypted at host"
}
},
"workerEncryptionAtHost": {
"type": "string",
"defaultValue": "Disabled",
"allowedValues": [
"Enabled",
"Disabled"
],
"metadata": {
"description": "Specify if worker VMs are encrypted at host"
}
}
},
"variables": {
"resourceGroupId": "[format('/subscriptions/{0}/resourceGroups/aro-{1}-{2}', subscription().subscriptionId, parameters('domain'), parameters('location'))]",
"masterSubnetId": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('clusterVnetName'), 'master')]",
"workerSubnetId": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('clusterVnetName'), 'worker')]"
},
"resources": [
{
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2023-06-01",
"name": "[parameters('clusterVnetName')]",
"location": "[parameters('location')]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"[parameters('clusterVnetCidr')]"
]
},
"subnets": [
{
"name": "master",
"properties": {
"addressPrefixes": [
"[parameters('masterSubnetCidr')]"
],
"serviceEndpoints": [
{
"service": "Microsoft.ContainerRegistry"
}
]
}
},
{
"name": "worker",
"properties": {
"addressPrefixes": [
"[parameters('workerSubnetCidr')]"
],
"serviceEndpoints": [
{
"service": "Microsoft.ContainerRegistry"
}
]
}
}
]
}
},
{
"type": "Microsoft.ManagedIdentity/userAssignedIdentities",
"apiVersion": "2023-01-31",
"name": "cloud-controller-manager",
"location": "[parameters('location')]"
},
{
"type": "Microsoft.ManagedIdentity/userAssignedIdentities",
"apiVersion": "2023-01-31",
"name": "ingress",
"location": "[parameters('location')]"
},
{
"type": "Microsoft.ManagedIdentity/userAssignedIdentities",
"apiVersion": "2023-01-31",
"name": "machine-api",
"location": "[parameters('location')]"
},
{
"type": "Microsoft.ManagedIdentity/userAssignedIdentities",
"apiVersion": "2023-01-31",
"name": "disk-csi-driver",
"location": "[parameters('location')]"
},
{
"type": "Microsoft.ManagedIdentity/userAssignedIdentities",
"apiVersion": "2023-01-31",
"name": "cloud-network-config",
"location": "[parameters('location')]"
},
{
"type": "Microsoft.ManagedIdentity/userAssignedIdentities",
"apiVersion": "2023-01-31",
"name": "image-registry",
"location": "[parameters('location')]"
},
{
"type": "Microsoft.ManagedIdentity/userAssignedIdentities",
"apiVersion": "2023-01-31",
"name": "file-csi-driver",
"location": "[parameters('location')]"
},
{
"type": "Microsoft.ManagedIdentity/userAssignedIdentities",
"apiVersion": "2023-01-31",
"name": "aro-operator",
"location": "[parameters('location')]"
},
{
"type": "Microsoft.ManagedIdentity/userAssignedIdentities",
"apiVersion": "2023-01-31",
"name": "cluster",
"location": "[parameters('location')]"
},
{
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"scope": "[format('Microsoft.Network/virtualNetworks/{0}/subnets/{1}', parameters('clusterVnetName'), 'master')]",
"name": "[guid(resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('clusterVnetName'), 'master'), 'cloud-controller-manager')]",
"properties": {
"principalId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cloud-controller-manager'), '2023-01-31').principalId]",
"roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'a1f96423-95ce-4224-ab27-4e3dc72facd4')]",
"principalType": "ServicePrincipal"
},
"dependsOn": [
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cloud-controller-manager')]",
"[resourceId('Microsoft.Network/virtualNetworks', parameters('clusterVnetName'))]"
]
},
{
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"scope": "[format('Microsoft.Network/virtualNetworks/{0}/subnets/{1}', parameters('clusterVnetName'), 'worker')]",
"name": "[guid(resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('clusterVnetName'), 'worker'), 'cloud-controller-manager')]",
"properties": {
"principalId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cloud-controller-manager'), '2023-01-31').principalId]",
"roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'a1f96423-95ce-4224-ab27-4e3dc72facd4')]",
"principalType": "ServicePrincipal"
},
"dependsOn": [
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cloud-controller-manager')]",
"[resourceId('Microsoft.Network/virtualNetworks', parameters('clusterVnetName'))]"
]
},
{
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"scope": "[format('Microsoft.Network/virtualNetworks/{0}/subnets/{1}', parameters('clusterVnetName'), 'master')]",
"name": "[guid(resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('clusterVnetName'), 'master'), 'ingress')]",
"properties": {
"principalId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'ingress'), '2023-01-31').principalId]",
"roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0336e1d3-7a87-462b-b6db-342b63f7802c')]",
"principalType": "ServicePrincipal"
},
"dependsOn": [
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'ingress')]",
"[resourceId('Microsoft.Network/virtualNetworks', parameters('clusterVnetName'))]"
]
},
{
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"scope": "[format('Microsoft.Network/virtualNetworks/{0}/subnets/{1}', parameters('clusterVnetName'), 'worker')]",
"name": "[guid(resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('clusterVnetName'), 'worker'), 'ingress')]",
"properties": {
"principalId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'ingress'), '2023-01-31').principalId]",
"roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0336e1d3-7a87-462b-b6db-342b63f7802c')]",
"principalType": "ServicePrincipal"
},
"dependsOn": [
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'ingress')]",
"[resourceId('Microsoft.Network/virtualNetworks', parameters('clusterVnetName'))]"
]
},
{
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"scope": "[format('Microsoft.Network/virtualNetworks/{0}/subnets/{1}', parameters('clusterVnetName'), 'master')]",
"name": "[guid(resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('clusterVnetName'), 'master'), 'machine-api')]",
"properties": {
"principalId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'machine-api'), '2023-01-31').principalId]",
"roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0358943c-7e01-48ba-8889-02cc51d78637')]",
"principalType": "ServicePrincipal"
},
"dependsOn": [
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'machine-api')]",
"[resourceId('Microsoft.Network/virtualNetworks', parameters('clusterVnetName'))]"
]
},
{
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"scope": "[format('Microsoft.Network/virtualNetworks/{0}/subnets/{1}', parameters('clusterVnetName'), 'worker')]",
"name": "[guid(resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('clusterVnetName'), 'worker'), 'machine-api')]",
"properties": {
"principalId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'machine-api'), '2023-01-31').principalId]",
"roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0358943c-7e01-48ba-8889-02cc51d78637')]",
"principalType": "ServicePrincipal"
},
"dependsOn": [
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'machine-api')]",
"[resourceId('Microsoft.Network/virtualNetworks', parameters('clusterVnetName'))]"
]
},
{
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"scope": "[format('Microsoft.Network/virtualNetworks/{0}', parameters('clusterVnetName'))]",
"name": "[guid(resourceId('Microsoft.Network/virtualNetworks', parameters('clusterVnetName')), 'cloud-network-config')]",
"properties": {
"principalId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cloud-network-config'), '2023-01-31').principalId]",
"roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'be7a6435-15ae-4171-8f30-4a343eff9e8f')]",
"principalType": "ServicePrincipal"
},
"dependsOn": [
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cloud-network-config')]",
"[resourceId('Microsoft.Network/virtualNetworks', parameters('clusterVnetName'))]"
]
},
{
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"scope": "[format('Microsoft.Network/virtualNetworks/{0}', parameters('clusterVnetName'))]",
"name": "[guid(resourceId('Microsoft.Network/virtualNetworks', parameters('clusterVnetName')), 'file-csi-driver')]",
"properties": {
"principalId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'file-csi-driver'), '2023-01-31').principalId]",
"roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0d7aedc0-15fd-4a67-a412-efad370c947e')]",
"principalType": "ServicePrincipal"
},
"dependsOn": [
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'file-csi-driver')]",
"[resourceId('Microsoft.Network/virtualNetworks', parameters('clusterVnetName'))]"
]
},
{
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"scope": "[format('Microsoft.Network/virtualNetworks/{0}', parameters('clusterVnetName'))]",
"name": "[guid(resourceId('Microsoft.Network/virtualNetworks', parameters('clusterVnetName')), 'image-registry')]",
"properties": {
"principalId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'image-registry'), '2023-01-31').principalId]",
"roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '8b32b316-c2f5-4ddf-b05b-83dacd2d08b5')]",
"principalType": "ServicePrincipal"
},
"dependsOn": [
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'image-registry')]",
"[resourceId('Microsoft.Network/virtualNetworks', parameters('clusterVnetName'))]"
]
},
{
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"scope": "[format('Microsoft.Network/virtualNetworks/{0}/subnets/{1}', parameters('clusterVnetName'), 'master')]",
"name": "[guid(resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('clusterVnetName'), 'master'), 'aro-operator')]",
"properties": {
"principalId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'aro-operator'), '2023-01-31').principalId]",
"roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '4436bae4-7702-4c84-919b-c4069ff25ee2')]",
"principalType": "ServicePrincipal"
},
"dependsOn": [
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'aro-operator')]",
"[resourceId('Microsoft.Network/virtualNetworks', parameters('clusterVnetName'))]"
]
},
{
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"scope": "[format('Microsoft.Network/virtualNetworks/{0}/subnets/{1}', parameters('clusterVnetName'), 'worker')]",
"name": "[guid(resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('clusterVnetName'), 'worker'), 'aro-operator')]",
"properties": {
"principalId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'aro-operator'), '2023-01-31').principalId]",
"roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '4436bae4-7702-4c84-919b-c4069ff25ee2')]",
"principalType": "ServicePrincipal"
},
"dependsOn": [
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'aro-operator')]",
"[resourceId('Microsoft.Network/virtualNetworks', parameters('clusterVnetName'))]"
]
},
{
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"scope": "[format('Microsoft.ManagedIdentity/userAssignedIdentities/{0}', 'cloud-controller-manager')]",
"name": "[guid(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cloud-controller-manager'), 'cluster')]",
"properties": {
"principalId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cluster'), '2023-01-31').principalId]",
"roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ef318e2a-8334-4a05-9e4a-295a196c6a6e')]",
"principalType": "ServicePrincipal"
},
"dependsOn": [
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cloud-controller-manager')]",
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cluster')]"
]
},
{
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"scope": "[format('Microsoft.ManagedIdentity/userAssignedIdentities/{0}', 'ingress')]",
"name": "[guid(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'ingress'), 'cluster')]",
"properties": {
"principalId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cluster'), '2023-01-31').principalId]",
"roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ef318e2a-8334-4a05-9e4a-295a196c6a6e')]",
"principalType": "ServicePrincipal"
},
"dependsOn": [
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cluster')]",
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'ingress')]"
]
},
{
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"scope": "[format('Microsoft.ManagedIdentity/userAssignedIdentities/{0}', 'machine-api')]",
"name": "[guid(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'machine-api'), 'cluster')]",
"properties": {
"principalId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cluster'), '2023-01-31').principalId]",
"roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ef318e2a-8334-4a05-9e4a-295a196c6a6e')]",
"principalType": "ServicePrincipal"
},
"dependsOn": [
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cluster')]",
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'machine-api')]"
]
},
{
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"scope": "[format('Microsoft.ManagedIdentity/userAssignedIdentities/{0}', 'disk-csi-driver')]",
"name": "[guid(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'disk-csi-driver'), 'cluster')]",
"properties": {
"principalId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cluster'), '2023-01-31').principalId]",
"roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ef318e2a-8334-4a05-9e4a-295a196c6a6e')]",
"principalType": "ServicePrincipal"
},
"dependsOn": [
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cluster')]",
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'disk-csi-driver')]"
]
},
{
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"scope": "[format('Microsoft.ManagedIdentity/userAssignedIdentities/{0}', 'cloud-network-config')]",
"name": "[guid(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cloud-network-config'), 'cluster')]",
"properties": {
"principalId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cluster'), '2023-01-31').principalId]",
"roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ef318e2a-8334-4a05-9e4a-295a196c6a6e')]",
"principalType": "ServicePrincipal"
},
"dependsOn": [
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cloud-network-config')]",
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cluster')]"
]
},
{
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"scope": "[format('Microsoft.ManagedIdentity/userAssignedIdentities/{0}', 'image-registry')]",
"name": "[guid(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'image-registry'), 'cluster')]",
"properties": {
"principalId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cluster'), '2023-01-31').principalId]",
"roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ef318e2a-8334-4a05-9e4a-295a196c6a6e')]",
"principalType": "ServicePrincipal"
},
"dependsOn": [
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cluster')]",
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'image-registry')]"
]
},
{
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"scope": "[format('Microsoft.ManagedIdentity/userAssignedIdentities/{0}', 'file-csi-driver')]",
"name": "[guid(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'file-csi-driver'), 'cluster')]",
"properties": {
"principalId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cluster'), '2023-01-31').principalId]",
"roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ef318e2a-8334-4a05-9e4a-295a196c6a6e')]",
"principalType": "ServicePrincipal"
},
"dependsOn": [
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cluster')]",
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'file-csi-driver')]"
]
},
{
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"scope": "[format('Microsoft.ManagedIdentity/userAssignedIdentities/{0}', 'aro-operator')]",
"name": "[guid(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'aro-operator'), 'cluster')]",
"properties": {
"principalId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cluster'), '2023-01-31').principalId]",
"roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ef318e2a-8334-4a05-9e4a-295a196c6a6e')]",
"principalType": "ServicePrincipal"
},
"dependsOn": [
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'aro-operator')]",
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cluster')]"
]
},
{
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"scope": "[format('Microsoft.Network/virtualNetworks/{0}', parameters('clusterVnetName'))]",
"name": "[guid(resourceId('Microsoft.Network/virtualNetworks', parameters('clusterVnetName')), parameters('rpObjectId'))]",
"properties": {
"principalId": "[parameters('rpObjectId')]",
"roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '42f3c60f-e7b1-46d7-ba56-6de681664342')]",
"principalType": "ServicePrincipal"
},
"dependsOn": [
"[resourceId('Microsoft.Network/virtualNetworks', parameters('clusterVnetName'))]"
]
},
{
"type": "Microsoft.RedHatOpenShift/openShiftClusters",
"apiVersion": "2025-07-25",
"name": "[parameters('clusterName')]",
"location": "[parameters('location')]",
"properties": {
"clusterProfile": {
"domain": "[parameters('domain')]",
"resourceGroupId": "[variables('resourceGroupId')]",
"version": "[parameters('version')]",
"fipsValidatedModules": "[parameters('fips')]",
"pullSecret": "[parameters('pullSecret')]"
},
"networkProfile": {
"podCidr": "[parameters('podCidr')]",
"serviceCidr": "[parameters('serviceCidr')]"
},
"masterProfile": {
"vmSize": "[parameters('masterVmSize')]",
"subnetId": "[variables('masterSubnetId')]",
"encryptionAtHost": "[parameters('masterEncryptionAtHost')]"
},
"workerProfiles": [
{
"name": "worker",
"count": 3,
"diskSizeGB": "[parameters('workerVmDiskSize')]",
"vmSize": "[parameters('workerVmSize')]",
"subnetId": "[variables('workerSubnetId')]",
"encryptionAtHost": "[parameters('workerEncryptionAtHost')]"
}
],
"apiserverProfile": {
"visibility": "[parameters('apiServerVisibility')]"
},
"ingressProfiles": [
{
"name": "default",
"visibility": "[parameters('ingressVisibility')]"
}
],
"platformWorkloadIdentityProfile": {
"platformWorkloadIdentities": {
"cloud-controller-manager": {
"resourceId": "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cloud-controller-manager')]"
},
"ingress": {
"resourceId": "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'ingress')]"
},
"machine-api": {
"resourceId": "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'machine-api')]"
},
"disk-csi-driver": {
"resourceId": "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'disk-csi-driver')]"
},
"cloud-network-config": {
"resourceId": "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cloud-network-config')]"
},
"image-registry": {
"resourceId": "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'image-registry')]"
},
"file-csi-driver": {
"resourceId": "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'file-csi-driver')]"
},
"aro-operator": {
"resourceId": "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'aro-operator')]"
}
}
}
},
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"[format('{0}', resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cluster'))]": {}
}
},
"dependsOn": [
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'aro-operator')]",
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cloud-controller-manager')]",
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cloud-network-config')]",
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'cluster')]",
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'disk-csi-driver')]",
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'file-csi-driver')]",
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'image-registry')]",
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'ingress')]",
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'machine-api')]"
]
}
]
}
创建 Azure Red Hat OpenShift 群集
登录到 Azure 门户。
在 Azure 门户菜单或主页 上,选择左上角三个水平条下的所有服务。
搜索并选择“Azure Red Hat OpenShift 群集”。
选择“创建”。
在“基本信息”选项卡上,配置以下选项:
-
项目详细信息:
- 选择 Azure 订阅。
- 选择或创建 Azure 资源组,例如
test-aro-rg。
-
实例详细信息:
- 选择 Azure Red Hat OpenShift 群集的区域。
- 输入 OpenShift 群集名称,例如
testcluster。 - 输入 域名,例如
testdomain。 - 选择 OpenShift 群集版本
- 选择 主 VM 大小 和 辅助角色 VM 大小。
- 选择 工作节点数 (要创建的工作节点数量)。
注释
域名字段预填充有一个随机字符串。 可以指定域名(如 example.com)或字符串/前缀(如 abc),它们用于 OpenShift 控制台和 API 服务器的自动生成 DNS 名称的一部分。 如果未指定资源组名称,则此前缀还用作创建用于托管群集 VM 的资源组名称的一部分。
-
项目详细信息:
在“身份验证”选项卡上,完成以下部分。
可以使用托管标识或服务主体为群集选择身份验证机制。 默认值为托管标识。
在 托管标识下,选择 “自动创建标识和角色 ”或 “使用现有标识和角色分配”
如果选择 自动创建标识和角色,则登录的用户必须有权创建用户分配的托管标识和角色分配。 系统将代表你创建必要的用户分配的托管标识,并使用相应的内置角色进行适当的角色分配。
如果选择 “使用现有标识和角色分配”,则必须已创建正确的用户分配托管标识和相应的角色分配。 选择此选项将展开下面的一部分,以便为每个组件选择用户分配的托管标识。
注释
有关需要创建的用户分配托管标识和角色分配的详细信息,请参阅 “了解标识角色分配体系结构 ”。
为每个组件单击选择,标识选择边栏选项卡将在右侧打开,以便选择相应的托管标识。
在“网络”选项卡上,配置所需选项。
注释
运行 OpenShift 4 的 Azure Red Hat OpenShift 群集需要一个虚拟网络,其中包含两个空子网:一个用于控制平面,一个用于工作器节点。
注释
如果使用现有的托管标识,则必须具有现有的虚拟网络和子网。 作为群集创建流的一部分,将无法创建新的虚拟网络。
在标记选项卡,添加标记来组织资源。
选择 “查看 + 创建 ”,然后在验证完成后 创建 。 请记下您所选的身份验证机制,以及您选择的是自动化身份流程还是现有身份流程。
创建 Azure Red Hat OpenShift 群集大约需要 45 分钟。 部署完成后,通过以下任一方式导航到你的资源:
- 选择 转到资源。
- 浏览到 Azure Red Hat OpenShift 群集资源组,然后选择 Azure Red Hat OpenShift 资源。
清理
若要删除托管标识群集,请运行以下命令:
az aro delete -n $CLUSTER -g $RESOURCEGROUP
delete 命令不会清理在安装过程中创建的群集分配的托管标识。 需要手动删除标识和角色分配。
相关内容
有关详细信息,请参阅 了解 Azure Red Hat OpenShift 中的托管标识。