Deploy a local Kubernetes Cluster using MicroK8s and connect it to Azure Arc

The following Jumpstart scenario will guide you on how to use MicroK8s to run a Kubernetes cluster locally and connect it as an Azure Arc-enabled Kubernetes cluster resource.


  • Clone the Azure Arc Jumpstart repository

    git clone
  • Install or update Azure CLI to version 2.36.0 and above. Use the below command to check your current installed version.

    az --version
  • Install and Set Up kubectl

  • Install Helm 3

  • Create Azure service principal (SP)

    To be able to complete the scenario and its related automation, Azure service principal assigned with the “Contributor” role is required. To create it, login to your Azure account run the below command (this can also be done in Azure Cloud Shell).

    az login
    subscriptionId=$(az account show --query id --output tsv)
    az ad sp create-for-rbac -n "<Unique SP Name>" --role "Contributor" --scopes /subscriptions/$subscriptionId

    For example:

    az login
    subscriptionId=$(az account show --query id --output tsv)
    az ad sp create-for-rbac -n "JumpstartArcK8s" --role "Contributor" --scopes /subscriptions/$subscriptionId

    Output should look like this:

    "displayName": "JumpstartArcK8s",

    NOTE: If you create multiple subsequent role assignments on the same service principal, your client secret (password) will be destroyed and recreated each time. Therefore, make sure you grab the correct password.

    NOTE: The Jumpstart scenarios are designed with as much ease of use in-mind and adhering to security-related best practices whenever possible. It is optional but highly recommended to scope the service principal to a specific Azure subscription and resource group as well considering using a less privileged service principal account

  • Enable subscription with the two resource providers for Azure Arc-enabled Kubernetes. Registration is an asynchronous process, and registration may take approximately 10 minutes.

    az provider register --namespace Microsoft.Kubernetes
    az provider register --namespace Microsoft.KubernetesConfiguration
    az provider register --namespace Microsoft.ExtendedLocation

    You can monitor the registration process with the following commands:

    az provider show -n Microsoft.Kubernetes -o table
    az provider show -n Microsoft.KubernetesConfiguration -o table
    az provider show -n Microsoft.ExtendedLocation -o table
  • Install the Azure Arc for Kubernetes CLI extensions connectedk8s and k8s-configuration:

    az extension add --name connectedk8s
    az extension add --name k8s-configuration

    NOTE: If you already used this guide before and/or have the extensions installed, use the bellow commands:

    az extension update --name connectedk8s
    az extension update --name k8s-configuration


  • Install MicroK8s following the specific install guide for your operating system. For convenience, we’ve added some commands below:


    Download the MicroK8s installer for Windows and follow the instructions.

     MicroK8s installer for Windows

    Once installed, enable MicroK8s with:

    microk8s status --wait-ready
    microk8s enable dns


    sudo snap install microk8s --classic
    sudo usermod -a -G microk8s <username>
    sudo chown -f -R <username> ~/.kube
    newgrp microk8s
    microk8s status --wait-ready
    microk8s enable dns

    linux install microk8s


    brew install ubuntu/microk8s/microk8s
    microk8s install
    microk8s status --wait-ready
    microk8s enable dns

    brew install microk8s


    This blog post walks through an installation of MicroK8s in WSL 2.

  • Export MicroK8s cluster kubeconfig file path

    MicroK8s will not update your .kube/config file, and accessing the cluster is done using the microk8s cli, eg: microk8s kubectl get nodes. To be able to use this config with the Azure Arc CLI, we need to export it into a file.


    microk8s config view > %HOMEPATH%\.kube\microk8s

    Linux and MacOS:

    microk8s config view > ~/.kube/microk8s

Connect the cluster to Azure Arc

  • Authenticate Azure CLI

    We’ll start by authenticating our CLI with Azure, replacing the values below with the output from the command we issued to create service principal earlier (az ad sp create-for-rbac) in the prerequisite section of this guide.

    az login --service-principal -u appId -p password --tenant tenant

    Authenticate Azure CLI

  • Create a resource group

    az group create -n Arc-MicroK8s-Demo -l EastUS

    Create new Azure resource group

    Create new Azure resource group

  • Connect the cluster to Azure Arc


    az connectedk8s connect --name Arc-MicroK8s-Demo --resource-group Arc-MicroK8s-Demo --kube-config %HOMEPATH%\.kube\microk8s --kube-context microk8s --tags 'Project=jumpstart_azure_arc_k8s' --correlation-id "d009f5dd-dba8-4ac7-bac9-b54ef3a6671a"

    Linux and MacOS:

    az connectedk8s connect --name Arc-MicroK8s-Demo --resource-group Arc-MicroK8s-Demo  --kube-config ~/.kube/microk8s --kube-context microk8s --tags 'Project=jumpstart_azure_arc_k8s' --correlation-id "d009f5dd-dba8-4ac7-bac9-b54ef3a6671a"

    New Azure Arc-enabled Kubernetes cluster

  • Upon completion, you will have your MicroK8s cluster connected as a new Azure Arc Kubernetes cluster resource in a new resource group.

    New Azure Arc-enabled Kubernetes cluster

    New Azure Arc-enabled Kubernetes cluster

Optional - Day 2 Operations

Now that your Kubernetes cluster is connected to Azure Arc, you might want to explore the following Day 2 scenarios:

Delete the deployment

  • In Azure, the most straightforward way is to delete the cluster or the resource group via the Azure Portal or through the CLI.

    az group delete --name Arc-MicroK8s-Demo

    Delete Azure resource group

  • To stop the MicroK8s cluster locally, use the following command:

    microk8s stop
  • The uninstall process of MicroK8s depends on your operating system.


    Stop the MicroK8s VM in Multipass:

    multipass stop microk8s-vm

    Launch Add or Remove Programs and uninstall MicroK8s.

    Uninstall MicroK8s from Windows

    multipass delete microk8s-vm
    multipass purge

    If you want to completely uninstall Multipass, launch Add or Remove Programs and uninstall Multipass.

    Uninstall Multipass from Windows


    sudo snap remove microk8s


    brew uninstall ubuntu/microk8s/microk8s