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
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)
Step 4: You can provide scaling option for future usage but I am leaving them disabled for now.
Step 5: Provide Authentication Mechanism you want to follow
Step 6: This step allows you to play with networking part. I will use the default data provided by AKS.
Step 7: Provide data for VNet Creation
Note: If you are updating any data for VNet then make sure Service address range and Cluster Subnet should be aligned properly.
Step 8: Provide data for monitoring solution
Step 9: You can add tags as per the convenience. These tags helps in managing Azure components.
Step 10: Run the validation
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 aks install-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.
- name: nginx
- containerPort: 80
Create the pod by running following command -
kubectl create -f pod.yaml
Then check the status of POD -
Create a K8s LoadBalance rservice via following YAML file.
- port: 80
Once service is created, It takes few seconds for IP assignment of Load Balancer.
So as we can see it has assigned IP of LB to services. Now we can excess the service from internet itself.
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