Megosztás a következőn keresztül:


Azure Red Hat OpenShift-fürt létrehozása felügyelt identitásokkal (előzetes verzió)

Fontos

Ez az Azure Red Hat OpenShift szolgáltatás jelenleg csak előzetes verzióban érhető el. Az előzetes verziójú funkciók önkiszolgáló, opt-in alapon érhetők el. Az előzetes verziókat arendelkezésre álló és a rendelkezésre álló módon biztosítjuk, és ki vannak zárva a szolgáltatásiszint-szerződésekből és a korlátozott jótállásból. Az Azure Red Hat OpenShift előzetes verzióit részben az ügyfélszolgálat fedezi a legjobb munkamennyiség alapján. Ezért ezek a funkciók nem éles használatra vannak szánva.

Ez a cikk bemutatja, hogyan telepíthet egy Azure Red Hat OpenShift fürtöt felügyelt identitások használatával. A szolgáltatásnevet használó meglévő fürtök nem migrálhatók felügyelt identitás használatára. Létre kell hoznia egy új fürtöt, amely felügyelt identitást használ egy Azure Red Hat OpenShift-fürtön.

Az Azure Red Hat OpenShift egy felügyelt OpenShift szolgáltatás, amely támogatja a felügyelt identitásokat és a számítási feladatok identitását. A felügyelt identitások és a munkaterhelés identitásai segítenek minimalizálni a kockázatot a számítási feladatok és alkalmazások biztonságának megteremtésében azáltal, hogy hosszú élettartamú hitelesítő adatok, például ügyfél titkossági hitelesítő adatokkal rendelkező szolgáltatásnév helyett rövid élettartamú jogkivonatokat biztosítanak.

További információkért lásd:

Előfeltételek

Győződjön meg arról, hogy az Azure CLI 2.67.0-s vagy újabb verzióját használja. A telepített Azure CLI verziójának megkeresésére használható az--version . Ha telepítenie vagy frissítenie kell, tekintse meg az Azure CLI telepítését.

Az Azure Red Hat OpenShift legalább 44 magot igényel egy OpenShift-klaszter létrehozásához. Az új Azure-előfizetés alapértelmezett Azure-erőforráskvótája nem felel meg ennek a követelménynek. Ha növelni szeretné az erőforráskorlátot, olvassa el a VM-család vCPU-kvótáinak növelését.

A 44 magot a következőképpen használjuk:

  • Bootstrap gép: 8 mag
  • Vezérlősík (főgépek): 24 mag
  • Számítás (feldolgozó gépek): 12 mag

A telepítés befejezése után a rendszer eltávolítja a rendszerindító gépet, és a fürt összesen 36 magot használ. További információ: Telepítés az Azure-ban.

Például a legkisebb támogatott virtuálisgép-család "Standard DSv5" termékváltozatának aktuális előfizetési kvótájának ellenőrzéséhez:

LOCATION=eastus
az vm list-usage -l $LOCATION \
--query "[?contains(name.value, 'standardDSv5Family')]" -o table

Az Azure Red Hat OpenShift bővítménykerékfájl letöltése (csak előzetes verzió)

A cikkben szereplő parancsok futtatásához először töltse le az Azure Red Hat OpenShift bővítménykerékfájlt a következőből https://aka.ms/az-aroext-latest: . A bővítmény telepítéséhez futtassa a következő parancsot:

az extension add -s <path to downloaded whl file>

Engedélyek ellenőrzése

Ebben a cikkben egy erőforráscsoportot hoz létre, amely tartalmazza a fürt virtuális hálózatát és felügyelt identitását. Erőforráscsoport létrehozásához közreműködői és felhasználói hozzáférés-rendszergazdai engedélyekre vagy tulajdonosi engedélyekre van szüksége az azt tartalmazó erőforráscsoporthoz vagy előfizetéshez.

A kezelt identitások készletének létrehozásához és a fürt használatához megfelelő Microsoft Entra-engedélyekkel (a bérlő tagfelhasználójaként vagy a alkalmazás rendszergazdája szerepkört betöltő vendégfelhasználóként) is rendelkeznie kell. További információ: Tagok és vendégek , rendszergazdai és nemminisztrátori szerepkörök hozzárendelése Microsoft Entra-azonosítóval rendelkező felhasználókhoz.

Az erőforrás-szolgáltatók regisztrálása

Egyes Azure-erőforrás-szolgáltatók, köztük az Azure Red Hat OpenShift erőforrás-szolgáltató, regisztrációt igényelnek a működéshez. Az erőforrás-szolgáltató regisztrálása létrehoz egy egyszerű szolgáltatást az előfizetésen belül, amely engedélyezi az erőforrás-szolgáltatónak bizonyos műveletek végrehajtását, például az erőforrás-létrehozást. Az erőforrás-szolgáltató regisztrációval kapcsolatos további információkért lásd: Erőforrás-szolgáltató regisztrálása.

  1. Ha több Azure-előfizetéssel rendelkezik, adja meg a megfelelő előfizetés-azonosítót:

    az account set --subscription <SUBSCRIPTION ID>
    
  2. Az erőforrás-szolgáltató regisztrálása Microsoft.RedHatOpenShift :

    az provider register -n Microsoft.RedHatOpenShift --wait
    
  3. Az erőforrás-szolgáltató regisztrálása Microsoft.Compute :

    az provider register -n Microsoft.Compute --wait
    
  4. Az erőforrás-szolgáltató regisztrálása Microsoft.Storage :

    az provider register -n Microsoft.Storage --wait
    
  5. Az erőforrás-szolgáltató regisztrálása Microsoft.Authorization :

    az provider register -n Microsoft.Authorization --wait
    

Red Hat lekéréses titkos kód lekérése (nem kötelező)

Az Azure Red Hat OpenShift lekérési titkos kódja nem változtatja meg a Red Hat OpenShift-licenc költségét.

A Red Hat lekérési titkos kód lehetővé teszi a fürt számára, hogy hozzáférjen a Red Hat tárolóregisztrációs adatbázisaihoz, valamint más tartalmakhoz, például az OperatorHub operátoraihoz. Ez a lépés nem kötelező, de ajánlott. Ha később úgy dönt, hogy hozzáadja a lekéréses titkos kulcsot, kövesse ezt az útmutatót. A mező cloud.openshift.com akkor is törlődik a titkos kódból, ha a lekéréses titkos kód tartalmazza ezt a mezőt. Ez a mező egy további monitorozási funkciót tesz lehetővé, amely adatokat küld a RedHatnak, ezért alapértelmezés szerint le van tiltva. A funkció engedélyezéséhez lásd: Távoli állapotjelentés engedélyezése.

  1. Lépjen a Red Hat OpenShift fürtkezelő portálra , és jelentkezzen be.

    Be kell jelentkeznie a Red Hat-fiókjába, vagy létre kell hoznia egy új Red Hat-fiókot az üzleti e-mail-címével, és el kell fogadnia a használati feltételeket.

  2. Válassza a Lekérési titkos kód letöltése lehetőséget, majd töltse le az Azure Red Hat OpenShift-fürthöz használandó lekéréses titkos kulcsot.

    Tárolja a mentett pull-secret.txt fájlt biztonságos helyen. A fájl minden fürtlétrehozási folyamatban használható, ha olyan fürtöt kell kialakítania, amely mintákat és operátorokat foglal magában, amelyek a Red Hat vagy a minősített partnerek rendszerein belül kerülnek alkalmazásra.

    A parancs futtatásakor a az aro create paraméterrel hivatkozhat a lekéréses --pull-secret @pull-secret.txt titkos kódra. Hajtsa végre az aro create azt a könyvtárat, amelyben a fájlt tárolta pull-secret.txt . Ellenkező esetben cserélje le a elemet@pull-secret.txt.@/path/to/my/pull-secret.txt

    Ha a lekéréses titkos kódot másolni vagy más szkriptekben hivatkozik rá, a lekéréses titkos kódnak érvényes JSON-sztringként kell formáznia.

Egyéni tartomány előkészítése a fürthöz (nem kötelező)

A az aro create parancs futtatásakor a paraméterrel megadhat egy egyéni tartományt a --domain foo.example.com fürthöz.

Megjegyzés:

Ha fürtöt hoz létre az Azure CLI-vel, a tartománynév hozzáadása opcionális. A fürt portálon keresztüli hozzáadásakor tartománynévre (vagy az OpenShift-konzol és API-kiszolgálók automatikus DNS-nevének részeként használt előtagra) van szükség. További információkért lásd Rövid útmutató: Azure Red Hat OpenShift-fürt üzembe helyezése az Azure Portal használatával.

Ha egyéni tartományt ad meg a fürthöz, jegyezze fel a következő pontokat:

  • A fürt létrehozása után két DNS A rekordot kell létrehoznia a DNS-kiszolgálón a --domain által meghatározottakhoz.
    • api – az API-kiszolgáló IP-címére mutat
    • *.apps – a bejövő IP-címre mutat
    • A következő parancs végrehajtásával kérje le ezeket az értékeket a fürt létrehozása után: az aro show -n -g --query '{api:apiserverProfile.ip, ingress:ingressProfiles[0].ip}'.
  • Az OpenShift-konzol egy URL-címen érhető el, például https://console-openshift-console.apps.example.com, a beépített tartomány https://console-openshift-console.apps.<random>.<location>.aroapp.io helyett.
  • Az OpenShift alapértelmezés szerint önaláírt tanúsítványokat használ az egyéni tartományokon *.apps.example.comlétrehozott összes útvonalhoz. Ha úgy dönt, hogy egyéni DNS-t használ a fürthöz való csatlakozás után, kövesse az OpenShift dokumentációját , hogy konfiguráljon egy egyéni hitelesítésszolgáltatót a bejövőforgalom-vezérlőhöz és egy egyéni hitelesítésszolgáltatót az API-kiszolgálóhoz.

Telepítés

Az Azure CLI, a Bicep vagy egy Azure Resource Manager-sablon (ARM-sablon) használatával olyan Azure Red Hat OpenShift-fürtöt telepíthet, amely felügyelt identitásokat használ.

Telepítés az Azure CLI használatával

Ez a szakasz azt ismerteti, hogyan hozhat létre Azure Red Hat OpenShift-fürtöt felügyelt identitásokkal az Azure CLI használatával.

Két üres alhálózatot tartalmazó virtuális hálózat létrehozása

Hozzon létre egy két üres alhálózatot tartalmazó virtuális hálózatot. Ha rendelkezik az igényeinek megfelelő meglévő virtuális hálózattal, hagyja ki ezt a lépést.

További információ a hálózatkezelésről és a követelményekről: Hálózatkezelés az Azure Red Hat OpenShifthez.

  1. Állítsa be a következő változókat abban a rendszerhéj-környezetben, amelyben végrehajtja a az parancsokat.

    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
    
  2. Hozzon létre egy erőforráscsoportot.

    Az Azure-erőforráscsoport olyan logikai csoport, amelyben az Azure-erőforrások üzembe helyezése és kezelése zajlik. Erőforráscsoport létrehozásakor meg kell adnia egy helyet. Ez a hely tárolja az erőforráscsoport metaadatait, és ahol az erőforrások az Azure-ban futnak, ha nem ad meg másik régiót az erőforrás létrehozása során. Hozzon létre egy erőforráscsoportot az az group create paranccsal.

    Megjegyzés:

    Az Azure Red Hat OpenShift nem érhető el minden olyan régióban, ahol azure-erőforráscsoport hozható létre. Az Azure Red Hat OpenShift támogatott helyéről az Elérhető régiók című témakörben olvashat.

    az group create \
      --location $LOCATION \
      --name $RESOURCEGROUP
    
  3. Hozzon létre egy virtuális hálózatot, valamint mester és munkavállalói alhálózatokat ugyanabban az erőforráscsoportban, amelyet korábban létrehozott.

    Az Azure Red Hat OpenShift-fürtökhöz két üres alhálózattal rendelkező virtuális hálózat szükséges a fő- és feldolgozó csomópontokhoz. Létrehozhat egy új virtuális hálózatot, vagy használhat egy meglévő virtuális hálózatot.

    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
    

A szükséges felhasználó által hozzárendelt felügyelt identitások létrehozása

  1. Hozza létre a következő szükséges identitásokat. Az Azure Red Hat OpenShift kilenc felügyelt identitást igényel, mindegyiknek hozzárendelt, beépített szerepkörre van szüksége:

    • Hét, az OpenShift-operátorokhoz kapcsolódó felügyelt identitás.
    • Egy felügyelt identitás az Azure Red Hat OpenShift szolgáltatás operátorához.
    • Egy másik identitás a fürt számára, amely lehetővé teszi ezen identitások használatát.

    A felügyelt identitás összetevői a következők:

    • OpenShift Image Registry-operátor (lemezkép-beállításjegyzék)
    • OpenShift Network Operator (felhős hálózat konfiguráció, cloud-network-config)
    • OpenShift Disk Storage Operátor (disk-csi-driver)
    • OpenShift File Storage Operátor (file-csi-driver)
    • OpenShift-fürt bejövőforgalom-operátora (bejövő)
    • OpenShift Cloud Controller Manager (felhővezérlő-kezelő)
    • OpenShift Machine API-operátor (machine-api)
    • Azure Red Hat OpenShift Service Operator (aro-operátor)

    Nyolc különböző felügyelt identitás és a hozzá tartozó beépített szerepkörök képviselik az Azure Red Hat OpenShift egyes összetevőihez szükséges engedélyeket a feladatai elvégzéséhez. Emellett a platformnak szüksége van egy másik identitásra, a fürtidentitásra a korábban felsorolt felügyelt identitásösszetevők (aro-fürt) összevont hitelesítő adatainak létrehozásához.

    A Red Hat OpenShift-fürt operátorairól további információt a Fürtoperátorok referencia című dokumentumban talál.

    Az Azure Red Hat OpenShift felügyelt identitásairól további információt az Azure Red Hat OpenShift felügyelt identitásainak ismertetése című témakörben talál.

    Hozza létre a szükséges identitásokat:

    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
    
  2. Hozza létre a szükséges szerepkör-hozzárendeléseket az egyes operátori identitásokhoz, a fürt identitásához és az első féltől származó szolgáltatásnévhez.

    Megjegyzés:

    Ez a cikk feltételezi, hogy csak a fő- és feldolgozói alhálózatok vannak jelen. Ha több fürtalhálózatot konfigurált a telepítéskor, engedélyt kell adnia a szerepkörök hozzárendelésére azokhoz az alhálózatokhoz, amelyeknél ezt az operátorok igénylik.

    A fő- és feldolgozói alhálózatok következő szerepkör-hozzárendelései feltételezik, hogy nincs hálózati biztonsági csoport (NSG), útvonaltábla vagy hálózati címfordítási (NAT) átjáró csatlakoztatva. Ha bármelyik hálózati erőforrást telepíti a telepítéshez, további szerepkör-hozzárendeléseket kell létrehoznia, amelyek az operátori identitások engedélyeit biztosítják a további hálózati erőforrásokhoz. Minden olyan operátor esetében, amely a következő alhálózatokhoz vagy a virtuális hálózathoz szerepkör-hozzárendelést igényel, az extra hálózati erőforráshoz is szükség van egy szerepkör-hozzárendelésre.

    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"
    

Hozza létre a fürtöt

Fürt létrehozásához futtassa a következő parancsot az opciók alatt. Ha az alábbi lehetőségek valamelyikét választja, módosítsa a parancsot ennek megfelelően:

  • 1. lehetőség: Átadhatja a Red Hat lekéréses titkos kódját, amely lehetővé teszi, hogy a fürt más tartalommal együtt hozzáférjen a Red Hat tárolóregisztrációs adatbázisaihoz. Adja hozzá az --pull-secret @pull-secret.txt argumentumot a parancshoz.
  • 2. lehetőség: Használhat egyéni tartományt. Adja hozzá az --domain foo.example.com argumentumot a parancshoz, és cserélje le foo.example.com a saját egyéni tartományára.

Hozza létre a fürtöt a szükséges környezetváltozókkal. Mindegyik --assign-platform-workload-identity jelölőnél az első argumentum a kulcsot jelöli, amely közli az Azure Red Hat OpenShift-erőforrás-szolgáltatóval, hogy melyik OpenShift-operátort használja egy adott identitáshoz. A második argumentum maga az identitásra mutató hivatkozás.

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

Ha az identitáserőforrások egy másik régióban vagy erőforráscsoportban találhatók, teljes erőforrásazonosítókat adhat át a létrehozáshoz. Lásd a következő példát:

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

Másik Azure Red Hat OpenShift-verzió kiválasztása

A fürt létrehozásakor dönthet úgy, hogy az Azure Red Hat OpenShift egy adott verzióját használja. Először a parancssori felülettel kérdezheti le az elérhető Azure Red Hat OpenShift-verziókat:

az aro get-versions --location <REGION>

A verzió kiválasztása után adja meg a --version paraméter segítségével a az aro create parancsban.

Telepítés a Bicep használatával

Ez a szakasz azt ismerteti, hogyan hozhat létre felügyelt identitásokkal rendelkező Azure Red Hat OpenShift-fürtöt a Bicep használatával.

  1. Mentse a példa Bicep-fájlt egy fájlba. Ebben a példában mentse azuredeploy.bicep néven.

  2. Állítsa be a következő változókat abban a rendszerhéj-környezetben, amelyben a az parancsokat tervez végrehajtani.

    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
    
  3. Hozzon létre egy erőforráscsoportot a fürterőforrás, a fürt virtuális hálózatának és identitásainak tárolásához.

    az group create --name $RESOURCEGROUP --location $LOCATION
    
  4. Az erőforrás-szolgáltatónál ellenőrizze az előfizetéséhez tartozó elsődleges szolgáltatási főobjektum azonosságát.

    ARO_RP_SP_OBJECT_ID=$(az ad sp list --display-name "Azure Red Hat OpenShift RP" --query '[0].id' -o tsv)
    
  5. A Bicep-fájl üzembe helyezése:

    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
    

    Ha a lekéréses titkos kód vagy az egyéni tartomány opcionális paramétereit használja, adjon hozzá egy sor-folytatási fordított perjelet (\) a rpObjectId paraméter után, és adja hozzá a következő paramétereket az üzembehelyezési parancshoz:

    --parameters domain=$DOMAIN \ #optional
    --parameters pullSecret=$PULL_SECRET # optional
    

Példa Bicep-fájlra

Megjegyzés:

Ez a cikk feltételezi, hogy csak a fő- és feldolgozói alhálózatok vannak jelen. Ha több fürtalhálózatot konfigurált a telepítéskor, engedélyt kell adnia a szerepkörök hozzárendelésére azokhoz az alhálózatokhoz, amelyeknél ezt az operátorok igénylik.

A fő- és feldolgozói alhálózatok következő szerepkör-hozzárendelései feltételezik, hogy nincs hálózati biztonsági csoport (NSG), útvonaltábla vagy hálózati címfordítási (NAT) átjáró csatlakoztatva. Ha bármelyik hálózati erőforrást telepíti a telepítéshez, további szerepkör-hozzárendeléseket kell létrehoznia, amelyek az operátori identitások engedélyeit biztosítják a további hálózati erőforrásokhoz. Minden olyan operátor esetében, amely a következő alhálózatokhoz vagy a virtuális hálózathoz szerepkör-hozzárendelést igényel, az extra hálózati erőforráshoz is szükség van egy szerepkör-hozzárendelésre.

@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}': {}
       }
   }
}

Telepítés ARM-sablonnal

Ez a szakasz azt ismerteti, hogyan hozhat létre ARM-sablont felügyelt identitásokkal rendelkező Azure Red Hat OpenShift-fürt létrehozásához.

  1. Mentse a példa ARM-sablont egy fájlba. Ebben a példában nevezze el a fájlt azuredeploy.json.

  2. Állítsa be a következő változókat abban a rendszerhéj-környezetben, amelyben a az parancsokat tervez végrehajtani.

    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
    
  3. Hozzon létre egy erőforráscsoportot a fürterőforrás, a fürt virtuális hálózatának és identitásainak tárolásához.

    az group create --name $RESOURCEGROUP --location $LOCATION
    
  4. Az erőforrás-szolgáltatónál ellenőrizze az előfizetéséhez tartozó elsődleges szolgáltatási főobjektum azonosságát.

    ARO_RP_SP_OBJECT_ID=$(az ad sp list --display-name "Azure Red Hat OpenShift RP" --query '[0].id' -o tsv)
    
  5. Az ARM-sablon üzembe helyezése:

    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
    

    Ha a lekéréses titkos kód vagy az egyéni tartomány opcionális paramétereit használja, adjon hozzá egy sor-folytatási fordított perjelet (\) a rpObjectId paraméter után, és adja hozzá a következő paramétereket az üzembehelyezési parancshoz:

    --parameters domain=$DOMAIN \ #optional
    --parameters pullSecret=$PULL_SECRET # optional
    

Példa ARM-sablonra

Megjegyzés:

Ez a cikk feltételezi, hogy csak a fő- és feldolgozói alhálózatok vannak jelen. Ha több fürtalhálózatot konfigurált a telepítéskor, engedélyt kell adnia a szerepkörök hozzárendelésére azokhoz az alhálózatokhoz, amelyeknél ezt az operátorok igénylik.

A fő- és feldolgozói alhálózatok következő szerepkör-hozzárendelései feltételezik, hogy nincs hálózati biztonsági csoport (NSG), útvonaltábla vagy hálózati címfordítási (NAT) átjáró csatlakoztatva. Ha bármelyik hálózati erőforrást telepíti a telepítéshez, további szerepkör-hozzárendeléseket kell létrehoznia, amelyek az operátori identitások engedélyeit biztosítják a további hálózati erőforrásokhoz. Minden olyan operátor esetében, amely a következő alhálózatokhoz vagy a virtuális hálózathoz szerepkör-hozzárendelést igényel, az extra hálózati erőforráshoz is szükség van egy szerepkör-hozzárendelésre.

{
  "$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', '4d97b98b-1d4f-4787-a291-c67834d212e7')]",
        "principalType": "ServicePrincipal"
      },
      "dependsOn": [
        "[resourceId('Microsoft.Network/virtualNetworks', parameters('clusterVnetName'))]"
      ]
    },
    {
      "type": "Microsoft.RedHatOpenShift/openShiftClusters",
      "apiVersion": "2024-08-12-preview",
      "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')]"
      ]
    }
  ]
}

Takarítás

A felügyelt identitásklaszter törléséhez futtassa a következő parancsot:

az aro delete -n $CLUSTER -g $RESOURCEGROUP

A törlési parancs nem törli a telepítés részeként létrehozott fürt által hozzárendelt felügyelt identitásokat. Manuálisan kell törölnie az identitásokat és a szerepkör-hozzárendeléseket.

További információ: Felügyelt identitások megismerése az Azure Red Hat OpenShiftben (előzetes verzió).