Setting up Azure Arc Data Services

Prerequisites

As part of Azure Arc, Microsoft will be able to provide a wide range of hybrid services. As of now in the early phases, one of the first things that Microsoft has available is Azure Arc Data Services which provides Azure SQL and PostgreSQL services on Azure Arc Enabled Kubernetes. 

Optimize administration of SQL Server instances in on-premises and multi-cloud environments by using Azure Arc - Azure Architecture Center | Microsoft Docs

To get this up and running there are numerous steps involved since you need to have an Azure Arc enabled Kubernetes cluster before we can start deploying the data controller which is responsible for deploying the managed database instances.

Additionally, you will need a set of numerous Azure extensions and resource providers registered before you continue so here is a list of extensions that you need to have in place. Firstly, you will need a machine to run the azure cli, kubectl and azdata installed.

Azure CLI Extensions (Verified by running az version)
az extension add --name connectedk8s 
az extension add --name k8s-extension 
az extension add --name customlocation
Resource Providers that need to be registered
az provider register --namespace Microsoft.ExtendedLocation
az provider register --namespace Microsoft.Kubernetes 
az provider register --namespace Microsoft.KubernetesConfiguration
Kubectl
az aks install-cli
Azure Data CLI

Install Azure Data CLI (azdata) with Windows Installer | Microsoft Docs

Azure Arc Enabled AKS

Once that is done you will need to have a Kubernetes environment to install Azure Arc on. In my example I create an Kubernetes Service in Azure which I will run Azure Arc Data Services on.

az group create --name aksrg --location westeurope
az aks create --resource-group aksrg --name aks --node-count 3 --enable-addons monitoring --generate-ssh-keys
Get Credentials using
az aks get-credentials --resource-group aksrg --name aks

This will merge the kubeconfig locally to allow to interact with the Kubernetes API.

Connect AKS Cluster to Azure Arc (Requires kubectl configured and reuse existing resource group)
az connectedk8s connect --name azurearc --resource-group aksrg

You can verify that Azure Arc Connections and services are running by using the following commands

kubectl -n azure-arc get deployments,pods

Next, you need to enable two additional features which are cluster-connect and custom locations. Cluster Connect extension is needed for the custom-location feature to work. Custom Locations provides a way for tenant administrators to use their Azure Arc enabled Kubernetes clusters as target locations for deploying Azure services instances. 

Use custom locations

az connectedk8s enable-features -n azurearc -g aksrg --features cluster-connect custom-locations

az k8s-extension create --name azdata --extension-type microsoft.arcdataservices --cluster-type connectedClusters -c azurearc -g aksrg --scope cluster --release-namespace arc --config Microsoft.CustomLocation.ServiceAccount=sa-bootstrapper
az connectedk8s show -n azurearc -g aksrg  --query id -o tsv

Get the extensionID references here (Copy the whole path)

az k8s-extension show --name azdata --cluster-type connectedClusters -c azurearc -g aksrg  --query id -o tsv

Get the Azure Resource Manager identifier for the Cluster Resource (ConnectClusterID)

az connectedk8s show -n azurearc -g aksrg --query id -o tsv

Create Custom Location (and verify deployment using the following commands)

az customlocation create -n norway -g aksrg  --namespace arc --host-resource-id <connectedClusterId> --cluster-extension-ids <extensionId>
az customlocation list-enabled-resource-types --resource-group aksrg --name norway
Deploy Data Controller (Points to your Azure Arc Enabled Cluster)

For the current update, deployment of Arc data controller in direct connectivity mode is only supported from Azure portal and not through the use of other deployment tools. This is to be able to use the latest update from Microsoft at this point.

3
You can monitor the progress by using the commands to monitor the deployment progress of the different containers within the pods. 

kubectl get datacontrollers -n arc
kubectl get pods --namespace arc

This will use a service type of Load Balancer, meaning that for each SQL instance that gets deployed it will get its own public IP address and be directly accessible from the SQL port.

Create a SQL Managed Instance on Azure Arc Enabled Kubernetes 

It should be noted that there is a current limitation that Azure Arc enabled SQL managed instances will not appear in the portal. So, if you want the resource to appear in the portal you will need to deploy it using the portal.

azdata login (namespace defined in earlier command is arc) 

Then you can create a managed instance by defining the command

azdata arc sql mi create -n sqldemo --storage-class-data managed-premium --storage-class-logs managed-premium

Then it will prompt you with a username and password for the SQL database.

Then you can view that the pod is creating within the Arc namespace, you can watch the creation using the command

kubectl get pods --namespace=arc --watch

Once it is done you can see the sqldemo-external-svc appear with a type of load balancer and with an associated public IP address. Now I should be able to connect to it as well using Azure Data Studio.

And voila!

 

Leave a Reply

Scroll to Top