How to install an AKS cluster for Mulesoft Runtime Fabric


Azure Kubernetes Services (AKS) is one of the most popular options for Mulesoft Runtime Fabric.
In this post, we'll go through all the necessary steps to provide an AKS cluster with an ingress controller, the two main prerequisites to install Runtime Fabric.

If you already have your AKS and Ingress controller ready, skip this post and go directly to the next post:
How to Install Mulesoft Runtime Fabric on AKS

There are three different ways you can install an AKS cluster:
  • Using the GUI
  • Using an Azure Resource Manager (ARM) template
  • Using the Azure CLI
In this tutorial, we'll be using the Azure CLI .

Prerequisites


Create a Resource Group

  • First, open a terminal and login to your Azure tenant with Azure CLI
az login
  • Your default web browser will open automatically showing you the Azure login web page to get your credentials. Insert your credentials and get back to the Azure CLI
  • In this tutorial we'll be creating our own Resource Group for this installation, but you can use your existing Resource Group if required
  • To create the Resource Group we'll run the following:
az group create --name rtf-resource-group --location eastus

Where rtf-resource-group is the name of our Resource Group for RTF and eastus is the region where we'll be deploying our AKS cluster.

  • If you're planning to use an existing resource group you can run the following command to get the details of your existing resource groups:
az group list

Create Environment Variables

Let's define some environment variables to parametrize our installation. We'll be using the following:
  • CLUSTER_NAME - The name we'll use for our AKS cluster
  • RG - The Resource Group we created earlier or the existing one we want to use
  • K8s_VERSION - The kubernetes version we'll be installing for AKS. Remember that the latest K8s version usually is not the same as the latest K8s version supported by RTF. Check out this link
  • NODE_COUNT - The number of Worker Nodes we want for our cluster. In this tutorial we'll use 2
  • NODE_VM_SIZE - The type of VM in Azure that we'll deploy for our Worker nodes. In this tutorial we'll use Standard_D2s_v2

Create the Cluster

At this point we've got everything to run our command to create the AKS cluster:
az aks create \
--resource-group $RG \
--name $CLUSTER_NAME \
--node-count $NODE_COUNT \
--generate-ssh-keys \
--kubernetes-version $K8S_VERSION \
--node-vm-size $NODE_VM_SIZE

Grab a cup of coffee... the process will take a few minutes. When the cluster creation is done we'll get a JSON message in our terminal with the details of our AKS cluster.

You will also see your new AKS cluster as a new resource in your resource group in the Azure Portal.


Configure kubectl

Once we've got our AKS cluster, it's time to connect to it with our beloved kubectl. The Azure CLI cluster installation does not update our kubeconfig file to connect to our cluster. For that, we need to run the aks get-credentials command:

az aks get-credentials --resource-group $RG --name $CLUSTER_NAME
This command will add a new cluster, user and context to the kubeconfig file and will set the current context to the AKS cluster. Run the following command to double-check:
kubectl config current-context
And lastly, run a kubectl command against your cluster to check you can connect to it:
kubectl get nodes



Install Ingress Controller

  • There are multiple options for your ingress controller - NGINX, AWS ALB, Traefik... In this tutorial we’ll install NGINX. For full details on NGINX installation click on this link to the official docs.
  • From your web browser, if you navigate to this URL, you'll get a YAML-formatted response that contains all the K8s resources to be created to install NGINX as ingress controller for your cluster.
  • From your terminal run the command below. That will download the content of the nginx configuration to a local file called nginx-ingress.yaml
curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.11.1/deploy/static/provider/cloud/deploy.yaml --output nginx-ingress.yaml

  • Then we’ll create all the resources using that file
kubectl apply -f nginx-ingress.yaml

We should get a response with all the resources created:


In AKS, when we deploy the LoadBalancer service of the ingress controller, as you might have noticed, it creates a Public IP. It'll show up as External IP in the list of services of the Azure Portal.



Unlike it happens in other cloud providers like AWS with EKS, Azure creates a public IP to access externally our cluster but it does not create a DNS record for that. That's an extra configuration we can do following these links:

Now, our AKS cluster is ready to start the installation of Runtime Fabric. That's what we'll cover in our next post:

    Previous Post Next Post