|
| 1 | +--- |
| 2 | +title: "Create an Arc-enabled AKS cluster in an Extended Zone" |
| 3 | +description: Learn how to creat an arc-enabled AKS cluster in an Extended Zone. |
| 4 | +author: svaldes |
| 5 | +ms.author: svaldes |
| 6 | +ms.service: azure-extended-zones |
| 7 | +ms.topic: arc-enabled AKS in Extended Zones |
| 8 | +ms.date: 05/02/2025 |
| 9 | +ms.custom: arc-enabled-aks, extended-zones |
| 10 | + |
| 11 | +# Customer intent: As a cloud administrator and Azure Extended Zones user, I want a quick method to deploy PaaS services via Arc in an Azure Extended Zone. |
| 12 | +--- |
| 13 | + |
| 14 | +# Create an Arc-enabled AKS cluster in an Extended Zone |
| 15 | + |
| 16 | +In this article, you will learn how to create an Arc-enabled AKS cluster in an Extended Zone. This will help you deploy PaaS services through Arc. Current supported PaaS workloads are ContainerApps, ManagedSQL and PostgreSQL. |
| 17 | + |
| 18 | +## Prerequisites |
| 19 | + |
| 20 | +- [An Azure account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) with an active subscription. |
| 21 | +- Access to an Extended Zone. For more information, see [Request access to an Azure Extended Zone](request-access.md). |
| 22 | +- Azure Cloud Shell or Azure CLI. Install the [Azure CLI](/cli/azure/install-azure-cli). |
| 23 | +- Access to a public or private container registry, such as the [Azure Container Registry](/azure/container-registry/). |
| 24 | +- Review the [requirements and limitations](/azure/container-apps/azure-arc-overview) of the public preview. Of particular importance are the cluster requirements. |
| 25 | + |
| 26 | +## Getting Started |
| 27 | +If you are already familiar with the topics below, you may skip this paragraph. There are important topics you may want read before you proceed with creation: |
| 28 | +• [Overview of Azure Arc-enabled data services](/azure/azure-arc/data/overview) |
| 29 | +• [Connectivity modes and requirements](/azure/azure-arc/data/connectivity) |
| 30 | +• [Storage configuration and Kubernetes storage concepts](/azure/azure-arc/data/storage-configuration) |
| 31 | +• [Kubernetes resource model](https://github.com/kubernetes/design-proposals-archive/blob/main/scheduling/resources.md#resource-quantities) |
| 32 | + |
| 33 | +### Setup |
| 34 | +Install the following Azure CLI extensions. |
| 35 | +```powershell |
| 36 | +az extension add --name connectedk8s --upgrade --yes |
| 37 | +az extension add --name k8s-extension --upgrade --yes |
| 38 | +az extension add --name customlocation --upgrade --yes |
| 39 | +``` |
| 40 | + |
| 41 | +Register the required namespaces. |
| 42 | +```powershell |
| 43 | +az provider register --namespace Microsoft.ExtendedLocation --wait |
| 44 | +az provider register --namespace Microsoft.KubernetesConfiguration --wait |
| 45 | +az provider register --namespace Microsoft.App --wait |
| 46 | +az provider register --namespace Microsoft.OperationalInsights --wait |
| 47 | +``` |
| 48 | + |
| 49 | +### Create an Arc-enabled AKS cluster in Extended Zones |
| 50 | + |
| 51 | +Before proceeding to deploy PaaS workloads in Extended Zones, an Arc-enabled AKS cluster has to be created in the target Extended Zone. The following script will help do that and ease the deployment of supported PaaS services (see related content at the end of this article to learn more about them). |
| 52 | + |
| 53 | +> [!NOTE] |
| 54 | +> Please make sure to keep parameters consistent and transfer them correctly from this script to any following ones. |
| 55 | + |
| 56 | +```powershell |
| 57 | +# Create an ARC-enabled AKS cluster on an edge zone |
| 58 | +function createArcEnabledAksOnEz { |
| 59 | + param( |
| 60 | + [string] $SubscriptionId, |
| 61 | + [string] $AKSClusterResourceGroupName, |
| 62 | + [string] $location = "westus", |
| 63 | + [string] $AKSName, |
| 64 | + [string] $edgeZone, |
| 65 | + [int] $nodeCount = 2, |
| 66 | + [string] $vmSize = "standard_nv12ads_a10_v5", |
| 67 | + [string] $ARCResourceGroupName, |
| 68 | + [switch] $Debug |
| 69 | + ) |
| 70 | + # Set the subscription |
| 71 | + az account set --subscription $SubscriptionId |
| 72 | + |
| 73 | + # Login to Azure |
| 74 | + az provider register --namespace Microsoft.AzureArcData |
| 75 | + |
| 76 | + # Create new resource group |
| 77 | + az group create --name $AKSClusterResourceGroupName --location $location |
| 78 | +
|
| 79 | + # Create new cluster and deploy in edge zone |
| 80 | + Write-Output "Creating AKS cluster in edge zone..." |
| 81 | + az aks create -g $AKSClusterResourceGroupName -n $AKSName --location $location --edge-zone $edgeZone --node-count $nodeCount -s $vmSize --generate-ssh-keys |
| 82 | + |
| 83 | + # Create new resource group for ARC |
| 84 | + az group create --name $ARCResourceGroupName --location eastus |
| 85 | +
|
| 86 | + # Download cluster credentials and get AKS cluster context |
| 87 | + az aks get-credentials --resource-group $AKSClusterResourceGroupName --name $AKSName --overwrite-existing |
| 88 | +
|
| 89 | + # Connect the AKS cluster to ARC |
| 90 | + $CLUSTER_NAME = "$ARCResourceGroupName-cluster" # Name of the connected cluster resource |
| 91 | + Write-Output "Connecting AKS cluster to Azure Arc..." |
| 92 | + az connectedk8s connect --resource-group $ARCResourceGroupName --name $CLUSTER_NAME |
| 93 | +
|
| 94 | + # DEBUG: Test connection to ARC |
| 95 | + if ($Debug) { |
| 96 | + Write-Debug az connectedk8s show --resource-group $ARCResourceGroupName --name $CLUSTER_NAME |
| 97 | + } |
| 98 | +} |
| 99 | +
|
| 100 | +
|
| 101 | +createArcEnabledAksOnEz -SubscriptionId "ffc37441-49e9-4291-a520-0b2d4972bb99" ` |
| 102 | + -AKSClusterResourceGroupName "t1" ` |
| 103 | + -location "westus" ` |
| 104 | + -AKSName "my-aks-cluster" ` |
| 105 | + -edgeZone "losangeles" ` |
| 106 | + -nodeCount 2 ` |
| 107 | + -vmSize "standard_nv12ads_a10_v5" ` |
| 108 | + -ARCResourceGroupName "t2" |
| 109 | +``` |
| 110 | + |
| 111 | + |
| 112 | +## Clean up resources |
| 113 | + |
| 114 | +When no longer needed, delete **my-aks-cluster** resource group and all of the resources it contains using the [az group delete](/cli/azure/group#az-group-delete) command. |
| 115 | + |
| 116 | +```azurecli-interactive |
| 117 | +az group delete --name my-aks-cluster |
| 118 | +``` |
| 119 | + |
| 120 | +## Related content |
| 121 | + |
| 122 | +- [Deploy arc-enabled workloads in an Extended Zone: ContainerApps](/azure/extended-zones/arc-enabled-workloads-container-apps) |
| 123 | +- [Deploy arc-enabled workloads in an Extended Zone: PostgreSQL](/azure/extended-zones/arc-enabled-workloads-postgresql) |
| 124 | +- [Deploy arc-enabled workloads in an Extended Zone: ManagedSQL](/azure/extended-zones/arc-enabled-workloads-managedsql) |
| 125 | +- [Deploy an AKS cluster in an Extended Zone](deploy-aks-cluster.md) |
| 126 | +- [Deploy a storage account in an Extended Zone](create-storage-account.md) |
| 127 | +- [Frequently asked questions](faq.md) |
0 commit comments