Bring your own Kubernetes cluster to Azure — Azure Arc

 

There are use cases where customers wants to bring on-premises resources to cloud and tap on cloud services to easily manage it as well. Microsoft Azure Arc helps you extend Azure management to any infrastructure and enables deployment of Azure data services anywhere. It actually simplify day to day monitoring and management of the resource from an operations perspective and you can leverage the goodness of cloud to on premise resources. Azure Arc is still in preview and currently supports Kubernetes, SQL Servers, VMs and HCI and additional features are being developed under the hood. Initially I thought to onboard my Raspberry Pi cluster to Arc, but unfortunately preview version doesn’t support armv7 or armv8 architecture yet. So in this article , we will setup a Kubernetes single node on a VM and integrate with Azure Arc.

We can easily setup a Kubernetes cluster using Rancher K3s. Please not that you need to have Azure Account and subscription to setup the following resources. You may create an account using the portal. The below code snippet is executed on the VM (Ubuntu-18.04).

curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="server --tls-san $(curl ifconfig.me) --write-kubeconfig-mode 644" INSTALL_K3S_CHANNEL=latest sh -

Once it has been setup, next step is to install Azure CLI and login to your azure account and register azure providers for Kubernetes.

https://gist.github.com/mysticrenji/d3a7b179be7ce578d29e8fc3a0c828f3

If the connection is successful, you would see the cluster in the Azure Arc.

Enable Monitoring in Azure Arc Kubernetes
To enable monitoring on Azure Arc resources, you need to have Log Analytics Workspace Resource created in the Azure resource group. Recommended to put in the same resource group where Azure Arc was created. You may the steps provided in this link to create it. Once its created, please use the below code snippet to enable the monitoring feature in Azure Arc

https://gist.github.com/mysticrenji/a9ec25604114d7305ad4d1727908b32f

If enablement is complete, the metrics from inside the Kubernetes cluster will gradually start appear in the app insights section.

We will be able check the metrics — CPU, Disk, Pod logs etc. from Kubernetes with Azure monitor — Insight. The metrics will be published in the log analytics workspace and also we can write custom query to fetch details and even configure alerts.

So we have covered the integration part of Kubernetes with Azure Arc and also the monitoring side. Hope Arc would go GA soon with extended support for other platforms. Like always, please share your feedback and share it.

References
Arc Installations
Enable Monitoring

Comments

Popular posts from this blog

The Complete Guide to Vue.js User Authentication with Auth0

Cloud Logging Strategies for Multi-Cloud Environments

Azure Pipelines vs. GitHub Actions