Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

Create an Arc-enabled AKS cluster in an Extended Zone

In this article, you learn how to create an Arc-enabled AKS cluster in an Extended Zone. This cluster helps you deploy PaaS services through Azure Arc. For currently supported PaaS workloads, see Service offerings for Azure Extended Zones.

Prerequisites

Getting started

If you're already familiar with the subject, you can skip this paragraph. Here are important topics you might want to read before you proceed with creation:

Setup

Install the following Azure CLI extensions.

az extension add --name connectedk8s --upgrade --yes
az extension add --name k8s-extension --upgrade --yes
az extension add --name customlocation --upgrade --yes

Register the required namespaces.

az provider register --namespace Microsoft.ExtendedLocation --wait
az provider register --namespace Microsoft.KubernetesConfiguration --wait
az provider register --namespace Microsoft.App --wait
az provider register --namespace Microsoft.OperationalInsights --wait

Create an Arc-enabled AKS cluster in Extended Zones

Before you deploy PaaS workloads in Extended Zones, create an Arc-enabled AKS cluster in the target Extended Zone. The following script helps you create the cluster and eases the deployment of supported PaaS services. To learn more about these services, see the related content at the end of this article.

Note

Make sure to keep parameters consistent and transfer them correctly from this script to any following scripts.

# Create an Arc-enabled AKS cluster on an edge zone
function createArcEnabledAksOnEz {
 param(
 [string] $SubscriptionId,
 [string] $AKSClusterResourceGroupName,
 [string] $location = "westus",
 [string] $AKSName,
 [string] $edgeZone,
 [int] $nodeCount = 2,
 [string] $vmSize = "standard_nv12ads_a10_v5",
 [string] $ArcResourceGroupName,
 [switch] $Debug
 )
 # Set the subscription
 az account set --subscription $SubscriptionId
 
 # Login to Azure
 az provider register --namespace Microsoft.AzureArcData
 
 # Create new resource group
 az group create --name $AKSClusterResourceGroupName --location $location

 # Create new cluster and deploy in edge zone
 Write-Output "Creating AKS cluster in edge zone..." 
 az aks create -g $AKSClusterResourceGroupName -n $AKSName --location $location --edge-zone $edgeZone --node-count $nodeCount -s $vmSize --generate-ssh-keys 
 
 # Create new resource group for Arc
 az group create --name $ArcResourceGroupName --location eastus

 # Download cluster credentials and get AKS cluster context
 az aks get-credentials --resource-group $AKSClusterResourceGroupName --name $AKSName --overwrite-existing

 # Connect the AKS cluster to Arc
 $CLUSTER_NAME = "$ArcResourceGroupName-cluster" # Name of the connected cluster resource
 Write-Output "Connecting AKS cluster to Azure Arc..."
 az connectedk8s connect --resource-group $ArcResourceGroupName --name $CLUSTER_NAME

 # DEBUG: Test connection to Arc
 if ($Debug) {
 Write-Debug az connectedk8s show --resource-group $ArcResourceGroupName --name $CLUSTER_NAME
 }
}


createArcEnabledAksOnEz -SubscriptionId "ffc37441-49e9-4291-a520-0b2d4972bb99" `
 -AKSClusterResourceGroupName "t1" `
 -location "westus" `
 -AKSName "my-aks-cluster" `
 -edgeZone "losangeles" `
 -nodeCount 2 `
 -vmSize "standard_nv12ads_a10_v5" `
 -ArcResourceGroupName "t2"

Clean up resources

When you no longer need the resources, delete the my-aks-cluster resource group and all of the resources it contains by using the az group delete command.

az group delete --name my-aks-cluster

Related content


Feedback

Was this page helpful?

Additional resources