Getting Started with Microsoft AKS

Setting up a Kubernetes cluster from scratch is no easy task. Luckily, there are now many managed service offerings which create a Kubernetes cluster for you.
Many of these providers also take responsibility for keeping your cluster up to date.

In this blog post we will take a closer look at AKS, the Kubernetes-as-a-service offering from Microsoft Azure. The Azure team did a great job of automating the configuration of all the different Kubernetes cluster components. With AKS we can deploy a 3-node cluster in about 15 minutes.

So Lets Get To Work!

If you do not already have an Azure account, Microsoft offers a free trial with $200 in credit toward their cloud services. AKS counts as a cloud service, so get out there and get signed up!

With AKS you will only be paying for the virtual machine instances, storage, and networking resources consumed by your Kubernetes cluster; you won’t have to pay for the etcd nodes, the API server components, etc.


Before we get started, make sure to have the following tools installed:

On Linux:

curl -sL | sudo bashaz aks install-cli

On macOS:

brew install azure-cli
az aks install-cli

To fully enjoy your kubectl experience, you may want to install autocomplete.

Spinning Up Our Cluster

After everything is installed, you will need to log into Microsoft Azure using the az CLI:

az login

If you have multiple subscriptions, you can optionally set the subscription you
wish to use by using the az account set command, like this:

az account set --subscription "SUBSCRIPTION-NAME"

We now need to create a resource group. A resource group is a collections of assets which will hold virtual machines, load balancers, networking components etc. When you are all done with your Kubernetes cluster, you can delete the resource group to trivially clean up after yourself.

To create our resource group:

$ az group create --name my-aks-rg --location eastus

Here, our resource group is named my-aks-rg and is provisioned in the US – East region (eastus).

To provision our new cluster, use az aks create:

$ az aks create \
   --name my-aks \
   --resource-group my-aks-rg \
   --node-count 3 \

This should take approximately 15 minutes.

After the cluster is up and running we need to tell kubectl how to connect to it to deploy stuff to it. Luckily, the az CLI provides a painless way of doing this:

$ az aks get-credentials --name my-aks --resource-group my-aks-rg
$ kubectl config current-context

Verifying Our New Cluster

Let’s verify our shiny new cluster by deploying a simple web-based application, complete with a front-end load balancer:

$ kubectl apply -f

We can get the address of the load balancer from the welcome service:

$ kubectl get services -n welcome

Copy the IP that from that command into your web browser, and you should see:

Go you!


Spread the word

twitter icon facebook icon linkedin icon