重要
現在、この Azure Red Hat OpenShift 機能はプレビューでのみ提供されています。 プレビュー機能は、セルフサービスのオプトイン ベースで利用できます。 プレビュー は 現状のまま、可能な範囲で 提供され、サービス レベル アグリーメントおよび限定保証から除外されます。 Azure Red Hat OpenShift プレビューは、ベストエフォート ベースでカスタマー サポートによって部分的にカバーされます。 そのため、これらの機能は、運用環境での使用を意図していません。
この記事では、マネージド ID を使用して Azure Red Hat OpenShift クラスターをデプロイする方法について説明します。 サービス プリンシパルを使用する既存のクラスターを移行してマネージド ID を使用することはできません。 Azure Red Hat OpenShift クラスターでマネージド ID を使用する新しいクラスターを作成する必要があります。
Azure Red Hat OpenShift は、マネージド ID とワークロード ID をサポートするマネージド OpenShift サービスです。 マネージド ID とワークロード ID は、クライアント シークレット資格情報を持つサービス プリンシパルなどの有効期間の長い資格情報ではなく、有効期間の短いトークンを提供することで、ワークロードとアプリケーションをセキュリティで保護するときのリスクを最小限に抑えるのに役立ちます。
詳細については、以下を参照してください。
[前提条件]
Azure CLI バージョン 2.67.0 以上を使用していることを確認してください。
az--version
を使用して、インストールした Azure CLI のバージョンを確認します。 インストールまたはアップグレードが必要な場合は、Azure CLI のインストールを参照してください。
Azure Red Hat OpenShift では、OpenShift クラスターを作成するために少なくとも 44 コアが必要です。 新しい Azure サブスクリプションの既定の Azure リソース クォータは、この要件を満たしていません。 リソースの制限の引き上げを依頼するには、「 VM ファミリの vCPU クォータの増加」を参照してください。
44 コアは次のように使用されます。
- ブートストラップ マシン: 8 コア
- コントロール プレーン (マスター マシン): 24 コア
- コンピューティング (ワーカー マシン): 12 コア
インストールが完了すると、ブートストラップ マシンが削除され、クラスターで合計 36 コアが使用されます。 詳細については、「 Azure へのインストール」を参照してください。
たとえば、サポートされている最小の仮想マシン ファミリ SKU "Standard DSv5" の現在のサブスクリプション クォータを確認するには、次のようにします。
LOCATION=eastus
az vm list-usage -l $LOCATION \
--query "[?contains(name.value, 'standardDSv5Family')]" -o table
Azure Red Hat OpenShift 拡張ホイール ファイルをダウンロードする (プレビューのみ)
この記事のコマンドを実行するには、まず、 https://aka.ms/az-aroext-latestから Azure Red Hat OpenShift 拡張ホイール ファイルをダウンロードします。 拡張機能をインストールするには、次のコマンドを実行します。
az extension add -s <path to downloaded whl file>
アクセス許可を確認する
この記事では、クラスターの仮想ネットワークとマネージド ID を含むリソース グループを作成します。 リソース グループを作成するには、それを含むリソース グループまたはサブスクリプションに対する共同作成者およびユーザー アクセス管理者のアクセス許可または所有者アクセス許可が必要です。
また、一連のマネージド ID を作成し、クラスターで使用するロールを割り当てるための十分な Microsoft Entra アクセス許可 (テナントのメンバー ユーザー、または ロールアプリケーション管理者が割り当てられたゲスト) も必要です。 詳細については、「 メンバーとゲスト」および 「 Microsoft Entra ID を持つユーザーに管理者ロールと非管理者ロールを割り当てる」を参照してください。
リソース プロバイダーを登録する
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 プル シークレットを使用すると、クラスターは OperatorHub からのオペレーター ハブの他のコンテンツと共に Red Hat コンテナー レジストリにアクセスできます。 この手順は省略可能ですが、推奨されます。 後でプル シークレットを追加する場合は、このガイダンス に従ってください。 pull-secret に cloud.openshift.com
フィールドが含まれている場合でも、このフィールドはシークレットから削除されます。 このフィールドにより、RedHat にデータを送信する追加の監視機能が有効になるので、既定では無効になっています。 この機能を有効にするには、「 リモート正常性レポートの有効化」を参照してください。
Red Hat OpenShift クラスター マネージャー ポータルに移動し、サインインします。
Red Hat アカウントにサインインするか、ビジネス用メールで新しい Red Hat アカウントを作成し、使用条件に同意する必要があります。
[ プル シークレットのダウンロード] を選択し、Azure Red Hat OpenShift クラスターで使用するプル シークレットをダウンロードします。
保存済みの
pull-secret.txt
ファイルは安全な場所に保管してください。 Red Hat または認定パートナーのサンプルまたはオペレーターを含むクラスターを作成する必要がある場合は、各クラスター作成でこのファイルが使用されます。az aro create
コマンドを実行する場合は、--pull-secret @pull-secret.txt
パラメーターを使用してプル シークレットを参照できます。az aro create
ファイルを格納したディレクトリからpull-secret.txt
を実行します。 それ以外の場合は、@pull-secret.txt
を@/path/to/my/pull-secret.txt
で置き換えます。プル シークレットをコピーする場合や他のスクリプトで参照する場合は、プル シークレットを有効な JSON 文字列として書式設定する必要があります。
クラスターのカスタム ドメインを準備する (省略可能)
az aro create
コマンドを実行するときに、--domain foo.example.com
パラメーターを使用してクラスターのカスタム ドメインを指定することができます。
注
Azure CLI を使用してクラスターを作成する場合、ドメイン名の追加は省略可能です。 ポータルを使用してクラスターを追加するときは、ドメイン名 (または OpenShift コンソールおよび API サーバーの自動生成された DNS 名の一部として使用されるプレフィックス) が必要です。 詳細については、「 クイック スタート: Azure portal を使用して Azure Red Hat OpenShift クラスターをデプロイする」を参照してください。
クラスターのカスタム ドメインを指定する場合は、次の点に注意してください。
- クラスターを作成した後、指定した
--domain
の DNS サーバーに 2 つの DNS A レコードを作成する必要があります。- api - API サーバーの IP アドレスを指す
- *.apps - イングレス IP アドレスを指します
- クラスターの作成後に次のコマンドを実行して、これらの値を取得します:
az aro show -n -g --query '{api:apiserverProfile.ip, ingress:ingressProfiles[0].ip}'
。
- OpenShift コンソールは、組み込みのドメイン
https://console-openshift-console.apps.example.com
ではなく、https://console-openshift-console.apps.<random>.<location>.aroapp.io
などの URL で使用できます。 - OpenShift では、既定で、
*.apps.example.com
カスタム ドメインに作成されたすべてのルートに自己署名証明書が使用されます。 クラスターへの接続後にカスタム DNS を使用する場合は、OpenShift のドキュメントに従って 、イングレス コントローラー用のカスタム CA と API サーバー用のカスタム CA を構成する必要があります。
取り付け
Azure CLI または Bicep を使用して、マネージド ID を使用して Azure Red Hat OpenShift クラスターをデプロイできます。
Azure CLI を使用してインストールする
このセクションでは、Azure CLI を使用して、マネージド ID を使用して Azure Red Hat OpenShift クラスターを作成する方法について説明します。
2 つの空のサブネットを含む仮想ネットワークを作成する
2 つの空のサブネットを含む仮想ネットワークを作成します。 ニーズを満たす既存の仮想ネットワークがある場合は、この手順をスキップします。
ネットワークと要件の詳細については、「 Azure Red Hat OpenShift のネットワーク」を参照してください。
az
コマンドを実行するシェル環境で、次の変数を設定します。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 クラスターには、マスター ノードとワーカー ノード用に 2 つの空のサブネットを持つ仮想ネットワークが必要です。 新しい仮想ネットワークを作成するか、既存の仮想ネットワークを使用できます。
az network vnet create \ --resource-group $RESOURCEGROUP \ --name aro-vnet \ --address-prefixes 10.0.0.0/22
az network vnet subnet create \ --resource-group $RESOURCEGROUP \ --vnet-name aro-vnet \ --name master \ --address-prefixes 10.0.0.0/23
az network vnet subnet create \ --resource-group $RESOURCEGROUP \ --vnet-name aro-vnet \ --name worker \ --address-prefixes 10.0.2.0/23
必要なユーザー割り当てマネージド ID を作成する
次の必須 ID を作成します。 Azure Red Hat OpenShift には 9 つのマネージド ID が必要です。それぞれが、割り当てられた組み込みロールを持っている必要があります。
- コア OpenShift 演算子に関連する 7 つのマネージド ID。
- Azure Red Hat OpenShift サービス オペレーター用の 1 つのマネージド ID。
- これらの ID の使用を有効にするクラスターのもう 1 つの ID。
マネージド ID コンポーネントは次のとおりです。
- OpenShift イメージ レジストリ オペレーター (image-registry)
- OpenShift ネットワーク オペレーター (cloud-network-config)
- OpenShift ディスクストレージオペレーター (disk-csi-driver)
- OpenShift ファイルストレージオペレーター (file-csi-driver)
- OpenShift クラスターイングレス オペレーター (イングレス)
- OpenShift Cloud Controller Manager (クラウドコントローラーマネージャ)
- OpenShift Machine API Operator(OpenShiftのプラットフォーム内のコンポーネントであるmachine-api)
- Azure Red Hat OpenShift サービスオペレーター (aro-operator)
8 つの異なるマネージド ID と、その職務を実行するために Azure Red Hat OpenShift の各コンポーネントに必要なアクセス許可を表す、対応する組み込みロールがあります。 さらに、プラットフォームには、以前に一覧表示されたマネージド ID コンポーネント (aro-cluster) のフェデレーション資格情報の作成を実行するために、クラスター ID というもう 1 つの ID が必要です。
Red Hat OpenShift クラスターオペレーターの詳細については、「 クラスターオペレーターリファレンス」を参照してください。
Azure Red Hat OpenShift のマネージド ID の詳細については、「Azure Red Hat OpenShift のマネージド ID について」を参照してください。
必要な ID を作成します。
az identity create \ --resource-group $RESOURCEGROUP \ --name aro-cluster
az identity create \ --resource-group $RESOURCEGROUP \ --name cloud-controller-manager
az identity create \ --resource-group $RESOURCEGROUP \ --name ingress
az identity create \ --resource-group $RESOURCEGROUP \ --name machine-api
az identity create \ --resource-group $RESOURCEGROUP \ --name disk-csi-driver
az identity create \ --resource-group $RESOURCEGROUP \ --name cloud-network-config
az identity create \ --resource-group $RESOURCEGROUP \ --name image-registry
az identity create \ --resource-group $RESOURCEGROUP \ --name file-csi-driver
az identity create \ --resource-group $RESOURCEGROUP \ --name aro-operator
各オペレーター ID、クラスター ID、ファースト パーティ サービス プリンシパルに必要なロールの割り当てを作成します。
注
この記事では、マスター サブネットとワーカー サブネットのみが存在することを前提としています。 インストール時により多くのクラスター サブネットを構成した場合は、必要なオペレーターのために、それらのサブネットにロールの割り当てスコープを付与する必要があります。
マスター サブネットとワーカー サブネットに対する次のロールの割り当ては、ネットワーク セキュリティ グループ (NSG)、ルート テーブル、またはネットワーク アドレス変換 (NAT) ゲートウェイがアタッチされていないことを前提としています。 これらのネットワーク リソースのいずれかをインストールに取り込む場合は、追加のネットワーク リソースに対するオペレーター ID のアクセス許可を付与するロールの割り当てを作成する必要があります。 次のサブネットまたは仮想ネットワークのロールの割り当てを必要とするオペレーターごとに、追加のネットワーク リソースに対するロールの割り当ても必要です。
SUBSCRIPTION_ID=$(az account show --query 'id' -o tsv) # assign cluster identity permissions over identities previously created 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/4d97b98b-1d4f-4787-a291-c67834d212e7" \ --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
フラグの最初の引数はキーを表します。これは、特定の ID に使用する OpenShift オペレーターを Azure Red Hat OpenShift リソース プロバイダーに指示します。 2 番目の引数は、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 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 リソースが別の リージョン または リソース グループに存在する場合は、作成する完全なリソース 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 を使用して、マネージド ID を使用して Azure Red Hat OpenShift クラスターを作成する方法について説明します。
サンプル Bicep テンプレート (手順 5 の後にある) をファイルに保存します。
az
コマンドを実行する予定のシェル環境で、次の変数を設定します。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.15.35 # the version of the cluster PULL_SECRET=$(cat pull-secret.txt) # the Red Hat pull secret JSON, provided as file or string
クラスター リソースとクラスター仮想ネットワークと ID を保持するリソース グループを作成します。
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 (--parameters domain=$DOMAIN) \ #optional (--parameters pullSecret=$PULL_SECRET) # optional
Bicep テンプレートの例
注
この記事では、マスター サブネットとワーカー サブネットのみが存在することを前提としています。 インストール時により多くのクラスター サブネットを構成した場合は、必要なオペレーターのために、それらのサブネットにロールの割り当てスコープを付与する必要があります。
マスター サブネットとワーカー サブネットに対する次のロールの割り当ては、ネットワーク セキュリティ グループ (NSG)、ルート テーブル、またはネットワーク アドレス変換 (NAT) ゲートウェイがアタッチされていないことを前提としています。 これらのネットワーク リソースのいずれかをインストールに取り込む場合は、追加のネットワーク リソースに対するオペレーター ID のアクセス許可を付与するロールの割り当てを作成する必要があります。 次のサブネットまたは仮想ネットワークのロールの割り当てを必要とするオペレーターごとに、追加のネットワーク リソースに対するロールの割り当ても必要です。
@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', '4d97b98b-1d4f-4787-a291-c67834d212e7')
principalType: 'ServicePrincipal'
}
}
// create cluster
resource cluster 'Microsoft.RedHatOpenShift/openShiftClusters@2024-08-12-preview' = {
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}': {}
}
}
}
クリーンアップ
マネージド ID クラスターを削除するには、次のコマンドを実行します。
az aro delete -n $CLUSTER -g $RESOURCEGROUP
この削除コマンドでは、インストールの一部として作成されたクラスター割り当てマネージド ID はクリーンアップされません。 ID とロールの割り当てを手動で削除する必要があります。