AKS is a managed Kubernetes Service that helps us to deploy our applications without worrying about Control Plane and other things like regular updates support, Scaling, and high availability of your cluster.
Key Features:
Managed Control Plane: AKS provides a fully managed control plane. So that, you don’t need to configure things like the upgradation of Kubernetes cluster, patching, and monitoring. This will help us to focus on main things like deployment of the application.
Scalability: AKS provides the scalability feature in which we can scale our worker nodes according to our application traffic which will help us to achieve high availability. AKS also enables the scale-up option for the AKS Clusters.
Windows container support: You can run Linux containers on the AKS, But you can run Windows containers as well which will help developers to work on Windows base applications on the Kubernetes cluster.
Networking Configurations: To create AKS, networking is required. So, you can configure the networking part according to your requirements which helps you to provide fine-grained control on the Cluster networking configurations.
Integration with other services: You can integrate AKS with multiple Azure services like Azure AD, Azure Policy, Azure Monitor, etc to provide solutions within the cloud for container management.
Multi-worker nodes: AKS can create multiple node pools according to the application’s requirements.
If you want to read more features in a detailed way refer to the below link:
https://spot.io/resources/azure-kubernetes-service/
Azure AKS Costing
If you are new to AKS and want to explore the AKS service then, AKS comes under a free tier account. But the resources like computing, networking, and storage will have a cost. So use wisely. Remember, you can’t autoscale the clusters or nodes under the free tier.
Now, If you want to use AKS in your Organization It will cost you 0.10$ per cluster per hour similar to AWS EKS Cost but the AKS cluster will be in the Standard tier. You can auto-scale your clusters and worker nodes in the Standard tier.
There is one more tier which Premium and that will cost you 0.60$ per cluster per hour with advanced features. You can auto-scale your clusters and worker nodes in the Standard tier.
Let’s Dive into the Demo! 🛠️
To create AKS, we need to configure VNet and other networking things. If you are not a beginner in the cloud feel free to skip the network configuration part. But if you are new to AKS or in the Azure Cloud, I would say to follow each step. So, it will help you to get a better understanding of each service that is related to Azure AKS.
First of all, create a separate Resource Group by clicking on Create new.
Provide the name of your Virtual Network and click on Next.
Now, we have to create two public subnets for the high availability of our Azure Kubernetes.
Delete the default subnet and click on Add a subnet then add two subnets with your desired IP address range and click on Next.
Click on Review + create to validate the error in the configurations. If there is no error feel free to click on Create.
Once your deployment is done, in the search field enter Kubernetes services and click on the first one.
Click on Create and select Create a Kubernetes cluster.
Select the Same Resource Group that we have created while creating the Virtual Network. After that, provide the name to your AKS keep the things same as shown in the below snippet, and click on Node Pools.
In the Node pools section, we have to add Worker Node. Remember one thing the default node(agentpool) is a system node. So you don’t have to do anything with that node.
Click on Add node pool
Provide the name to your worker node and keep the things same as shown in the below snippet such as Node size and Mode, etc.
Now, click on Networking section.
Select the kubenet as Network configuration then, keep Calico as Network policy and click on Review + Create by skipping integrations and Advanced sections.
Once the validation is passed, click on Create.
Once your deployment is complete, click on Go to resource.
Click on Connect.
You will have to run two commands that are showing on the right of the snippet to configure it on local or Cloud Shell.
But, we will configure it on our local. For that, we need to install Azure CLI and kubectl on our local machine.
To install kubectl on your local machine follow the below commands.
curl -O https://s3.us-west-2.amazonaws.com/amazon-eks/1.28.3/2023-11-14/bin/linux/amd64/kubectl
curl -O https://s3.us-west-2.amazonaws.com/amazon-eks/1.28.3/2023-11-14/bin/linux/amd64/kubectl.sha256
sha256sum -c kubectl.sha256
openssl sha1 -sha256 kubectl
chmod +x ./kubectl
mkdir -p $HOME/bin && cp ./kubectl $HOME/bin/kubectl && export PATH=$HOME/bin:$PATH
echo 'export PATH=$HOME/bin:$PATH' >> ~/.bashrc
kubectl version --client
Once the kubectl is installed, you can install azurecli on your local by following the below commands.
Install Azure CLI on the local machine
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
To install AZ CLI on other OS, you can refer to the below link
https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt
Now, login to your Azure Account by below command
az login
Once you run the below command, a new tab will open in your browser which will validate your account. If you have already logged into that account then, it will be automatically logged in on the terminal as well and you will see output like below snippet.
Once you log in, you can run the command that was given by Azure to connect with AKS
Now, you can run the command to list the nodes which will help you to validate the connection as well.
kubectl get nodes
Now, let’s try to deploy the Apache application on AKS
apiVersion: apps/v1
kind: Deployment
metadata:
name: apache-app-deployment
labels:
app: apache-app
spec:
replicas: 2
selector:
matchLabels:
app: apache-app
template:
metadata:
labels:
app: apache-app
spec:
containers:
- name: apache-container
image: avian19/apache-ne:latest
ports:
- containerPort: 80
kubectl apply -f deployment.yml
Now, host the application outside of the Kubernetes Cluster by creating a service for the Apache application and observing the public in the EXTERNAL-IP Column.
apiVersion: v1
kind: Service
metadata:
name: apache
spec:
selector:
app: apache-app
type: LoadBalancer
ports:
- protocol: TCP
port: 80
kubectl apply -f svc.yaml
As our service type is LoadBalancer, AKS created one Load Balancer which will look like the below snippet.
Now, copy the EXTERNAL-IP that we get by running the list svc command in the previous step hit on the browser, and see the magic.