02 July, 2021

1. Azure Arc : Setting up 'Kubernetes - Azure Arc' with AKS cluster

At Ignite 2019, Satya Nadella, CEO of Microsoft, announced an array of new hybrid cloud products and services. The most significant announcement is Azure Arc, the hybrid and multi-cloud platform from Microsoft. With Azure Arc, Microsoft has expanded the support for resources running outside of Azure.

As of today Azure Arc allows you to manage the following resources outside Azure.

  • Servers - both physical and virtual machines running Windows or Linux.
  • Kubernetes clusters - supporting multiple Kubernetes distributions.
  • Azure data services - Azure SQL Managed Instance and PostgreSQL Hyperscale services.
  • SQL Server - enroll instances from any location.
Microsoft Azure Arc documentation:  https://docs.microsoft.com/en-us/azure/azure-arc/overview

Imp: Azure Arc is not available in all the regions as of today. In some regions it's already GA or in Preview or Not Available at all. So make sure you check Azure Product availability page often https://azure.microsoft.com/en-in/global-infrastructure/services/?products=azure-arc&regions=all

I do not have any K8s cluster running anywhere (not on-premise neither in any other cloud) except one running in Azure, so in this article, I would onboard that AKS cluster into Azure Arc. But the process is same for any kubernetes cluster running in any on-premise/cloud platform. 

So, without much theory... let's simply dive! 😉
  • Create an AKS cluster in Azure if you do not have it already. A basic cluster setup would do if in case you want to follow along.
  • We will issue some CLI commands in this demo. So, it's a good practice to have the latest CLI version installed if not already as old version may not support these commands.
  • Azure service principal assigned with the “Contributor” role is also required. So, login to azure from your CLI terminal and get that created. It can be any unique service principal name of your choice.
  • Copy the details from the above command and keep it in notepad. We would need these shortly
  • Now two namespaces needs to be registered. Microsoft.Kubernetes and Microsoft.KubernetesConfiguration.
  • The above commands are asynchronous in nature and hence you need to check their progress by the below commands. The Registration Status must show as "Registered" before you proceed forward.
  • Save the file and let's open the shell web interface (shell.azure.com) to run this script. Make sure the bash mode is selected
  • On successful upload, issue the ls -l command to find the file in the root directory
  • Run the file ". ./az_connect_aks.sh". The operation might take a while to complete.
  • Once done... go to the resource group of you AKS cluster to find one more cluster in there and that's the ARC cluster
  • You can also check the cluster by going into the Kubernetes - Azure Arc service instance  

That's it. You have successfully onboarded a kubernetes cluster in Kubernetes - Azure Arc. Now you can centrally monitor your kubernetes clusters running on any cloud, apply policies on those and do Git Operations sitting right in Azure. Isn't that cool stuff.

Congratulations! for coming this far. Hope this article will help you to further explore more on this feature.

Do share with me about your experience and what you have built upon this foundation. You can take it upto any level and integrate. I would love to hear from you.

No comments:

Post a Comment