How To Get Started With Azure AKS
Building the Kubernetes cluster and deploy a sample app
AKS is Microsoft Azure’s managed Kubernetes solution that lets you run and manage containerized applications in the cloud. Since this is a managed Kubernetes service, Microsoft takes care of a lot of things for us such as security, maintenance, scalability, and monitoring. This makes us quickly deploy our applications into the Kubernetes cluster without worrying about the underlying details of building it.
In this post, we will see how we can build the Kubernetes cluster on Azure AKS, Accessing clusters from outside, configuring kubectl to work with AKS cluster, and many more.
- Prerequisites
- Install Azure CLI and Configure
- Creating AKS Cluster
- Configure Kuebctl With AKS Cluster
- Example Project
- Create a Deployment and Access it
- Kubernetes Dashboard
- Delete the Cluster
- Summary
- Conclusion
Prerequisites
The prerequisites to this post are Docker essentials and Kubernests essentials. We are not going to discuss the basics such as what is a container or what is Kubernetes, rather, we will see how to build a Kubernetes cluster on Azure AKS. Below are the prerequisites you should know before going through this article
Docker Essentials
You need to understand Docker concepts such as creating images, container management, etc. Below are some of the links that you can understand about Docker if you are new.
- Docker Docs
- Docker — A Beginner’s guide to Dockerfile with a sample project
- Docker — Image creation and Management
- Docker — Container Management With Examples
- Understanding Docker Volumes with an example
Kubernetes Essentials
You need to understand Kubernetes' essentials as well along with Docker essentials. Here are some of the docs to help you understand the concepts of Kubernetes.
Microsoft Azure Account
You should have a Microsoft Azure Account. You can get a free account for one year. You should see the below screen after you login.

You need to create a subscription for your account. The most common is Pay As You Go subscription.


You need a subscription to be associated with your tenant so that all the cost is billed to this subscription.
Install Azure CLI and Configure
Once you have the Azure Account you can install Azure CLI. You can go to the below documentation and install Azure CLI based on your operation system. You can configure Azure CLI with your subscription.

Let’s list the subscription with the following command
az account listCreating AKS Cluster
First, you need a resource group for all your resources. Let’s create a resource with the following command
az group create --name myAKSGroup --location eastus
Let's create a cluster with the following command. Notice that we are using the same resource group that we created above. You can see the JSON formatted result after a few minutes.
az aks create --resource-group myAKSGroup --name sampleAKSCluster --node-count 3 --enable-addons monitoring --generate-ssh-keysYou can see the following cluster in the console.

Example Project
We have created the Kubernetes cluster on AKS. It’s time to look at the example project that we are deploying. Here is the Github link you can clone it and run it on your machine.
// clone the project
git clone https://github.com/bbachi/sample-app-aks.git// Running on docker
docker build -t sample-aks-image .
docker run -d --name sample-aks -p 80:80 sample-aks-image// tag and push the image
docker tag sample-aks-image bbachin1/sample-aks-image
docker push bbachin1/sample-aks-imageThis is a simple HTML file serving through the Nginx server.









