Azure Kubernetes Service — Quick Demo

Microsoft Azure is one of the most versatile cloud platform in the world. It provides many kind of services for IT Solutions starting from building, testing, deployment and management on Microsoft provided/managed data centers. Azure Kubernetes Service (AKS) is one of them. As the name says by using this service you can create an enterprise grade Kubernetes Cluster environment in minutes with out any container orchestration expertise. This services is customizable in terms on cluster concepts and you can configure as per your requirement. In this post I will provision a Kubernetes cluster by using this service. I have created a free account on Azure cloud for the demo.

Step 1: Login in Azure portal free account and look for Azure Kubernetes Service

Azure Kubenetes Service

Step 2: Click on Create Kubernetes Service and provide details like name, region etc.

Step 3: I have selected a small size VM so that I can add multiple worker nodes on my cluster. I have changed Default size to Standard DS2 v2 and added 3 nodes. (Free Service Limits the number of VM creation)

AKS Options for configuration

Step 4: You can provide scaling option for future usage but I am leaving them disabled for now.

AKS Scaling Option

Step 5: Provide Authentication Mechanism you want to follow

AKS Authentication

Step 6: This step allows you to play with networking part. I will use the default data provided by AKS.

AKS Networking

Step 7: Provide data for VNet Creation

AKS VNet Creation

Note: If you are updating any data for VNet then make sure Service address range and Cluster Subnet should be aligned properly.

AKS Vnet

Step 8: Provide data for monitoring solution

AKS Monitoring

Step 9: You can add tags as per the convenience. These tags helps in managing Azure components.

Step 10: Run the validation

Validate dataset 1
Validate dataset 2

Step 11: Once done, click on create. It takes few mins for Azure to create all components for this service. Once done you can list all components.

Thats all for creating a K8s cluster using AKS.

You can connect to the Kubernetes cluster from your local computer. To do so we need to install kubectl command line utility. Login in azure cli and run following command -

az login
az aks install-cli
Login in Azure CLI

Now we need to connect to your Kubernetes cluster via kubectl, use the az aks get-credentials command. The following example gets credentials for the AKS cluster named AKS in the AKSCluster (Resource Group):

Lets fetch more details from the cluster. The IPs allocated to nodes are from the pool which we have defined while configuring the cluster.

So our cluster is ready now to accept deployment. Lets deploy a nginx web server and expose it via LoadBalancer Kubernetes service to validate this cluster.

We will create a POD of nginx first via yaml file and then a service to access the pod.

apiVersion: v1
kind: Pod
name: nginx
name: nginx
env: dev
- name: nginx
image: nginx
memory: "128Mi"
cpu: "500m"
- containerPort: 80

Create the pod by running following command -

kubectl create -f pod.yaml

Then check the status of POD -

POD Status

Create a K8s LoadBalance rservice via following YAML file.

apiVersion: v1
kind: Service
name: nginx-front
type: LoadBalancer
- port: 80
env: dev

Once service is created, It takes few seconds for IP assignment of Load Balancer.

Kubernetes Service

So as we can see it has assigned IP of LB to services. Now we can excess the service from internet itself.

Access the POD

Thats all for this post. As you can see how easy it was to deploy a K8s Cluster by using AKS. To learn more about AKS please visit Microsoft documentation for it. Thanks

In quest of understanding How Systems Work !