Kubernetes is a rapidly evolving platform that manages container-based applications and their associated networking and storage components. It provides a declarative approach for deployments, backed by a robust set of APIs for management operations.
In this post, we will learn how to quickly configure AKS (Azure Kubernetes Services), we will also explore and deploy a sample application and see how to monitor AKS. But before that let’s have a quick understanding of Application Modernization using Microservices and Containers.
Evolution of Development and Deployment Model:
The development model has changed from the waterfall model to Agile and now its DevOps.
image: OCI
Similarly, Application Architecture has changed from Monolithic to N-tier, and now it is Microservices.
Microservice if deployed on a VM you are underutilizing the resources and thus the concept came of Containers.
The Deployed model has moved from Physical to Virtual Servers and now it is Containers.
New to Containers, check what is Container?
You may have 100 or 1000 of containers and these are managed by Containers.
Now, since you may have 100 or 1000 of containers, you need some mechanism to manage these Containers.
Orchestration is needed to manage these containers, if a container is down/fails or crashed, you need Orchestration to manage it, which means, this Orchestration will spin a new container or your auto-healing, auto-scaling, and many more features.
This will be where you need Container Orchestration, examples are Kubernetes, Mesos, and Docker.
Kubernetes is the leader in this.
What is Kubernetes?
Kubernetes is a rapidly evolving platform that manages container-based applications and their associated networking and storage components. Kubernetes focuses on the application workloads, not the underlying infrastructure components. Kubernetes provides a declarative approach to deployments, backed by a robust set of APIs for management operations.
You can build and run modern, portable, microservices-based applications, using Kubernetes to orchestrate and manage the availability of the application components.
New to Kubernetes, check here what is Kubernetes?
You can implement Kubernetes in two ways,
- Unmanaged K8S: On-Prem where you need to manage the master node and Worker node
- Managed: using Cloud Services like Azure Kubernetes Services
Your worker node is where your Applications are deployed. Your applications run under Pod(Pod is a collection of one or more Containers.)
So, you have multiple worker nodes, with Apps running on Pods inside those worker nodes, and all these worker nodes are managed by Master Nodes.
If you deploy Kubernetes as Unmanaged or on-prem you need to manage both Master nodes and worker nodes.
Another option to implement Kubernetes is using Cloud Platform, and it’s called Managed Kubernetes.
All cloud vendors have adapted Kubernetes in the Cloud, these are.
- AWS- EKS
- Microsoft Azure – AKS
- Google Cloud Platform – GKE
- Oracle Cloud – OKE
- Digital Ocean – DOKS
Kubernetes Cluster Architecture:
Now we are familiar with what is AKS, let’s talk a little bit about its Architecture and how the application is deployed in AKS, and then we will see how to create an AKS cluster in a demo.
Below is Azure Kubernetes Architecture where the Master node is managed by Azure and Worker nodes are managed by Customers.
image: Microsoft
To know more about the architecture, view here
Since the Master Node/Control plane is managed by a Cloud vendor, we will focus on Customer managed nodes (also called as Worker Nodes).
The worker node has below components:
Kubelet:
The container runtime and in container runtime, you have Containers Instance (Or ACI – Azure Container Instance) where you can have Azure Disk and Files/NFS.
Kube-proxy:
you need a Network where you interact with Azure Virtual Network or subnet within Azure Virtual Network. Each of these worked nodes will be running on an Azure VM
Pod:
POD is the smallest deployment unit in Kubernetes where your app runs.
Creating AKS Cluster:
There are various ways to create an AKS Cluster, using Azure Portal, Azure CLI, PowerShell, or ARM Template.
We will see how to create AKS using Azure Portal.
First, head over to the Azure Portal https://portal.azure.com and search Kubernetes to create AKS
Click on + Create you will see 2 options:
- Create a Kubernetes Cluster with Azure Arc: This option can be used if you want to connect your cluster running on other cloud providers (GCP, AWS) or your cluster running on your on-premise DC.
- Create a Kubernetes Cluster: We will use this option to create a cluster in the Azure environment.
If you need step by step guide to Creating AKS visit site
Watch the Video for the Demo:
Use the below table to configure your cluster.
| Category | Selections | Options |
| Basics | Subscription Resource Group Cluster Name Region Kubernetes Ver. Node Size Node Count (1-5) | Select the options as per your need. If you are learning, use the Cluster to minimize the Cost |
| Node Pool | Node Pool | In case you wan to handle a variety of workload Don’t add any more for now. |
| Enable Virtual Nodes | Virtual nodes enable network communication between pods that run in Azure Container Instances (ACI) and the AKS cluster. We are not using ACI, For now, don’t select this option. | |
| Authentication | Method: Service Principle OR System-assigned managed Identity | To interact with Azure APIs, an AKS cluster requires either an Azure Active Directory (AD) service principal or a managed identity. The preferred option is System-assigned managed Identity |
| Role-based access Control | Enabled RABC | |
| Encryption | Yes | |
| Networking | Network Configuration: Kebenet | Select no as of now, I will demonstrate this in upcoming blogs |
| OR Network Configuration: Azure CNI | The Azure CNI networking plug-in allows clusters to use a new or existing VNet with customizable addresses. Application pods are connected directly to the VNet, which allows for native integration with VNet features. This needs a better planning in advance. | |
| Integration | Container Registry | Select no as of now, I will demonstrate in upcoming blogs |
| Azure Monitor | Yes But if don’t select now, you can configure this later. | |
| Azure Policy | Disabled | |
| Tag | Name and Value | Add some values for cost management etc. |
Now, Review and Create.
You will see the AKS cluster in your Portal
Connect to your Cluster:
To manage and connect to your AKS cluster you use kubectl command which is already installed in Azure Cloud Shell
Configure kubectl to connect to your Kubernetes cluster
az aks get-credentials –resource-group myResourceGroup –name myAKSCluster
Verify the connection to your cluster
kubectl get nodes
RUN the Application:
You have successfully configured the AKS cluster. Now you need to deploy the application to AKS, in order to do so you need to understand below concepts.
As I stated earlier, Your application runs in PODs. Inside a worker node you deploy a POD and a POD will have a Container or one/more Containers. Normally you will have 1-1 relationship with Pod and Container.
These PODS deployments are done using YAML file
Deployments are typically created and managed with kubectl create or kubectl apply. Create a deployment by defining a manifest file in the YAML format.
Helm is commonly used to manage applications in Kubernetes. You can deploy resources by building and using existing public Helm CHARTS that contain a packaged version of application code and Kubernetes YAML manifests. We will cover this in another Blog.
Another important feature is to use ACE (Azure Container Registry), it provides cloud-based container image building for platforms including Linux, and Windows, and it can automate OS and framework patching for your Docker Containers.
Lots of concepts, Hold on.
To keep it simple, In this example, We will use kubectl apply command and specify the name of YAML manifest.
Click here to Follow these steps to Deploy the App:
TEST the Application:
When the application runs, a Kubernetes service exposes the application’s front end to the internet. This process can take a few minutes to complete.
To monitor progress,
kubectl get service azure-vote-front –watch
Use External IP to see your hosted App:
Conclusion:
The purpose of the post is to Get started with Application Modernization concepts using Containers. Understand the key concepts of the Container world, Evolution of Development, and Deployment models. We also learned how to quickly Create an AKS cluster using Azure Portal.
Keep watching this thread (App Modernization) to see more posts on AKS.
#Azure #AppModernization #AKS #k8s

