Azure Arc is a groundbreaking service from Microsoft that extends Azure’s management capabilities to resources across hybrid and multi-cloud environments. This includes servers, Kubernetes clusters, and data services located outside of Azure, whether on-premises or in other clouds. In this demo, we will go through the process of setting up Azure Arc to manage a Kubernetes cluster running on-premises, showcasing how Azure Arc brings Azure services and management to any infrastructure.

Preparing for the Demo

Before we start, ensure you have the following prerequisites met:

  1. Azure Subscription: You need an active Azure subscription. If you don’t have one, you can create a free account.

  2. Kubernetes Cluster: For the purposes of this demo, you should have a Kubernetes cluster running outside of Azure. This can be on your local machine (e.g., using Minikube) or any other cloud.

  3. Azure CLI: Ensure that Azure CLI is installed and configured on your system. You can download it from here.

  4. Helm: Helm is required to install the Azure Arc agents on your Kubernetes cluster. You can follow the installation instructions here.

Steps for the Demo

Step 1: Enable Azure Arc for Kubernetes

First, you need to enable Azure Arc for Kubernetes through the Azure portal. This can be done by searching for “Azure Arc” in the Azure portal and selecting “Kubernetes clusters” under Azure Arc.

Step 2: Connect Your Kubernetes Cluster to Azure Arc

  1. Register the Cluster:
    • In the Azure portal, go to the Azure Arc section and click on “Add” under Kubernetes clusters.
    • Follow the wizard to add an existing cluster. You will need to provide details about your cluster and generate a script to connect your cluster to Azure.
  2. Run the Generated Script:
    • Execute the script on a machine that has administrative access to your Kubernetes cluster. The script installs the Azure Arc agent using Helm and registers your Kubernetes cluster with Azure.
    • This script typically looks like this:
      az connectedk8s connect --name <Your-Cluster-Name> --resource-group <Your-Resource-Group>
      

Step 3: Verify Connection and Manage Kubernetes Resources

After connecting your Kubernetes cluster to Azure Arc, you can manage it just like any Azure Kubernetes Service (AKS) cluster:

  1. View the Cluster in Azure Portal:
    • Go back to the Azure Arc section in the Azure portal. You should see your Kubernetes cluster listed there.
  2. Deploy Applications:
    • You can now deploy applications to your cluster using the Azure portal, Azure CLI, or any GitOps configurations.
    • For example, to deploy an app using Azure CLI, you might use:
      az k8s-configuration create --name appconfig --cluster-name <Your-Cluster-Name> --resource-group <Your-Resource-Group> --operator-instance-name app --operator-namespace test --repository-url <Your-Repo-URL> --scope cluster --cluster-type connectedClusters
      
  3. Monitor and Govern:
    • Azure Arc provides unified monitoring and governance for all your clusters. You can apply Azure Policy definitions, monitor compliance, and use Azure Monitor just as you would with AKS.

Step 4: Clean-up Resources

After you’re done with the demo, you can disconnect and clean up resources to avoid incurring any unnecessary costs:

az connectedk8s delete --name <Your-Cluster-Name> --resource-group <Your-Resource-Group>

Conclusion

Azure Arc is a powerful tool that extends Azure’s management capabilities to virtually any infrastructure. By integrating on-premises Kubernetes clusters with Azure Arc, you can enjoy centralized management, consistent policy enforcement, and deployment practices across your environments. This demonstration highlights the simplicity and power of Azure Arc in bringing cloud practices to diverse infrastructures, making it an invaluable tool for hybrid and multi-cloud strategies.