Deploy Azure Arc resources on Azure Local with Azure Bicep š„
Recently, Iāve been experimenting with Azure Local in my home lab, where I have a cluster with two nodes (physically, this is one server with two nested nodes and one DC). While itās possible to navigate through the portal to deploy Azure Arc resources on Azure Local, why not take it up a notch and use Infrastructure as Code (IaC)? Today, Iāll demonstrate how to deploy Azure Arc resources, such as VM images, VMs, and Kubernetes (K8S) clusters on Azure Local using Azure Bicep. šŖš»
We can see the two nodes up and running as part of the Azure Local Cluster. The domain controller handles Active Directory (AD) and internal routing using RRAS.
The Azure Local cluster containing the 2 nodes in the Azure Portal.
The custom location is called azlocal-038-location
. We need this information for our Bicep deployment.
Before deploying an Arc VM on Azure Local, we need an image. Iāve created an Azure Bicep template to deploy the image.
Execute the Bicep deployment to create an image.
location="westeurope"
templateFile="main.bicep"
resourceGroup="rg-local-prod"
az deployment group create --resource-group $resourceGroup --template-file $templateFile
In the backend, it downloads the image and stores it in one of our User Storage locations as part of the Cluster Virtual Disks.
We can verify this by checking the Cluster Storage.
Now that we have a VM image, how can we deploy a VM based on it? Well, Iāve got another Bicep template to cover that! ⨠The main.bicep
template serves as the entry point for our Bicep configuration. It defines the parameters and variables used across the VM module-file.
The vm.bicep
module file is responsible for deploying the VM.
Letās run the deployment of the Arc VM on Azure Local using the image we just deployed using Bicep.
Just grab a coffee; we need to wait for a little while. ā
We can see that vm-a-l-t-001
is deployed and is hosted on the node 00-HCI-1
. It is operating normally as expected.
We can also see the vm-a-l-t-001
from the Azure Portal.
I can even visit my own website from the Arc VM on Azure Local. Isnāt that awesome? š¤Ŗ
Time to flex our Biceps and deploy an AKS Cluster on Azure Local using Azure Bicep. šŖš» The main.bicep template serves as the entry point for our Bicep configuration. It defines the parameters and variables used across the AKS module-file.
The aks.bicep
module file is responsible for deploying the AKS Cluster.
Letās run the Bicep deployment for our AKS cluster.
Once the AKS cluster is deployed, youāll notice two additional VMs on the node. This is because one VM handles the control plane of the AKS cluster, while the other runs the AKS node pool.
Also the AKS Azure Arc resource is visible within Azure.
We can connect to our k8s cluster using the Cloud Shell az connectedk8s proxy -n aks-ct01-prod -g rg-local-aks-prod
.
For example we can retrieve the existing nodes. š„
Azure Local is fantastic! Now, I can run low-latency-sensitive workloads right next to my operations and manage all the infrastructure within Azure using Azure Bicep. Thatās all for today! Feel free to share your feedback, and I look forward to our next session. Until then, take care! š