Skip to main content
Version: 1.0.0

Azure AKS Cluster


Katonic can natively run using an EKS cluster hosted on your own AWS account and an EKS cluster can also be used to run all your katonic job. This allows you to leverage katonic and Kubernetes to create one flexible compute and DS environment.

In this guide, you will learn how to:

  • Create a AKS cluster using the Azure CLI

Create a User in Azure with the Correct Permissions#

Creating an AKS cluster requires certain permissions within Azure. To be able to complete the guide and create the cluster, ensure your user account has been added to an Azure subscription with the role contributor. You can then create the cluster using the subscription.

Of course, any permission level higher than contributor should also be suitable.

Prerequisites: prepare your local environment#

Before you can complete the installation you must install and prepare the following dependencies on your local machine:

Use the Azure CLI to Connect to your Account#

NOTE You can skip this step if you have already logged in to the azure CLI and set the subscription for your account.

To be able to setup the cluster you will first need to log in to your Azure account in the Azure portal and create a subscription (for example, Pay As You Go).

To connect with your Azure account, use the Azure CLI:

  1. Login:
az login

TIP If you have multiple Azure Active Directories, you can specify the directory to use with the --tenant flag.

  1. Set your subscription. Fill in the name of you subscription at the beginning with the correct information for your cluster:
SUBSCRIPTION_NAME=<subscription-name>
az account set --subscription ${SUBSCRIPTION_NAME}

Create a Resource Group#

NOTE You can skip this step if you have already created a resource group.

If you do not yet have a group made for the katonic resources within Azure, create one with the following command. You will need to choose a location for the resources and a subscription. The location will affect which resources are available. Fill in the variables at the beginning with the correct information for your cluster:

SUBSCRIPTION_NAME=<subscription-name>
LOCATION=<zone>
RESOURCE_GROUP=<group_name>
az group create --name ${RESOURCE_GROUP} \
--location ${ZONE} \
--subscription ${SUBSCRIPTION_NAME}

TIP You can get a list of all available locations by running the following command:

az account list-locations

Create the AKS Cluster#

To create the cluster in Azure, use the following command. Fill in the variables at the beginning with the correct information for your cluster:

SUBSCRIPTION_NAME=<subscription-name>
CLUSTER_NAME=<cluster-name>
RESOURCE_GROUP=<group_name>
az aks create --name ${CLUSTER_NAME} \
--resource-group ${RESOURCE_GROUP} \
--node-count 2 \
--node-vm-size Standard_D8s_v3 \
--generate-ssh-keys \
--subscription ${SUBSCRIPTION_NAME} \
--enable-cluster-autoscaler \
--kubernetes-version=1.18.17

Retrieve the Credentials (kubeconfig) for the Newly Created Cluster#

Running the following command will save the kubeconfig for the new cluster locally. This allows you to be able to interact with it using kubectl.

The kubeconfig will be saved in ~/.kube/config

SUBSCRIPTION_NAME=<subscription-name>
CLUSTER_NAME=<cluster-name>
RESOURCE_GROUP=<group_name>
az aks get-credentials --name ${CLUSTER_NAME} --resource-group ${RESOURCE_GROUP} --subscription ${SUBSCRIPTION_NAME}

Check the Cluster is Working Correctly#

Run the following command to get a list of the nodes in the cluster. If this command runs correctly and returns the list of nodes, everything is working as expected:

kubectl get nodes

Conclusion#

Congratulations, you have now set up a working AKS cluster in Azure!

Follow this guide to complete the setup.