Establishing an AKS Kubernetes cluster.

Table of Contents

Abstract.

Introduction.

Prerequisites.

Creation of a Resource Group and the AKS Cluster.

Connection of the Cluster and Verification of the Cluster.

Test and deploy an application.

Conclusion.

  1. Abstract.

    The demand for reliable orchestration solutions has increased due to the growing popularity of containerized apps, and Kubernetes is now the industry standard. However, manually managing Kubernetes clusters frequently necessitates a high level of operational overhead and expertise. With its seamless integration with the Azure environment, Azure Kubernetes Service (AKS) offers a fully managed solution that streamlines cluster provisioning, scaling, and maintenance. This project outlines the procedure and benefits of setting up an AKS cluster, with a particular focus on how it facilitates DevOps and cloud-native application deployment. Businesses can obtain enterprise-grade scalability, high availability, and security features by utilizing AKS without the hassle of maintaining the Kubernetes control plane. Setting up an AKS cluster involves defining node pools, configuring cluster resources, establishing networking, and securing access using role-based access control (RBAC) and Azure Active Directory. Ultimately, AKS empowers businesses to focus on developing and innovating applications, ensuring faster delivery cycles, efficient resource utilization, and a robust foundation for modern cloud workloads.

  2. Introduction.

    Microsoft Azure's Azure Kubernetes Service (AKS) is a fully managed container orchestration solution that simplifies Kubernetes cluster setup, maintenance, and scaling. It provides businesses with a robust platform to host containerized applications without the complexities of managing Kubernetes control planes. Building an AKS cluster entails setting up a Kubernetes environment that enables developers to deploy, scale, and manage applications effectively. Teams can concentrate more on application development and innovation since AKS abstracts away crucial responsibilities, such as cluster provisioning, updates, monitoring, and interaction with Azure services, in contrast to self-managed Kubernetes clusters. Businesses may benefit from Azure's enterprise-grade security, high availability, and scalability features by utilizing AKS. Configuring the cluster resources, establishing node pools, establishing networking, and incorporating identity and access management are all common steps in the AKS cluster setup process. AKS is a smart option for cloud-native application deployment since it also easily connects with Azure's ecosystem, DevOps pipelines, and monitoring tools. In conclusion, setting up an AKS Kubernetes cluster gives companies a solid and expandable platform for creating contemporary applications, facilitating quicker delivery cycles, better use of resources, and increased operational effectiveness.

  3. Prerequisites.

    Before creating an AKS cluster in Microsoft Azure, certain technical and organizational requirements need to be met to ensure a smooth setup and deployment process.

    1. Azure Subscription.

    A valid Microsoft Azure account and subscription are required to create and manage AKS resources.

    Make sure that the right permissions are in place before allocating resources.

    2. Azure CLI / PowerShell / Portal Access.

    Azure CLI (latest version) or Azure PowerShell should be installed and configured.

    Alternatively, the Azure Portal can be used for GUI-based provisioning.

    Now, log in to Windows PowerShell and type az login —tenant <EntraID from your Azure account>, and a pop-up of your sign-in will show; choose the right account login and continue, as shown below.

  4. Creation of a Resource Group and the AKS Cluster.

    To manage and arrange linked resources in your Azure solution, you must first create a resource group. You can deploy, update, and remove resources as a single, coherent entity by using resource groups, which act as logical containers. Now, you have to create a Resource Group <az group create --name productionResourceGroup --location eastus> with the output as shown below.

    Next, to generate a key pair within the secure shell, i.e., the SSH directory, to generate public and private RSA keys, use the command ssh-keygen -f .ssh/my-ssh.

    Azure's resource groups offer an effective method of managing and allocating resources. Utilizing resource groups can help you enhance security and compliance, refine your resource management approach, and gain a deeper understanding of the cost structure of your Azure system. Now naming of an AKS cluster. In your Azure environment, naming your Azure Kubernetes Service (AKS) cluster is essential for cost tracking, resource management, and organization. A descriptive name facilitates consistent policy application, correct cost allocation, and the identification, filtering, and automation of actions on your clusters. The command listed below also modifies the names of the cluster's associated resources, including the node resource group, to facilitate easier maintenance and cleanup with this command (az aks create --resource-group productionResourceGroup --name myAKSCluster --node-count 1 --node-vm-size Standard_B2s --nodepool-name systempool --generate-ssh-keys). Kindly note that you may encounter an error that pops up "Missing Subscription Registration," in Azure PowerShell; this indicates that a required resource provider is not registered for your Azure subscription. This typically occurs when attempting to use a service or resource type for the first time within a subscription. You will need to register the missing resource provider from your Azure portal accordingly, and thereafter, please be aware that it will take some time to build and create, so please be patient while it is being created.

  5. Connection of the Cluster and Verification of the Cluster.

    Connecting to an AKS cluster involves the following;

    1. Fetching credentials with az aks get-credentials.

    2. kubectl is using those credentials to talk to the API server.

    3. The process by which Azure authenticates a user or application and then authorizes them to access resources according to their designated roles and responsibilities is known as authentication via Azure AD/RBAC.

    4. Secure communication with cluster components (etcd, kubelet, controllers).

      The subsequent step is to obtain the credentials for the established cluster, which will verify our current trajectory and facilitate the connection of kubectl to our cluster using the command, <az aks get-credentials --resource-group productionResourceGroup --name myAKSCluster>.

      Now you navigate to the Azure portal, and the resource groups and cluster are populated.

Note, the productionResourceGroup is where the AKS Cluster is housed, as shown below.

Now, on the PowerShell CLI, you run <kubectl get node>. It verifies the availability of nodes, checks their status, and resolves problems. This is a brief assessment of the cluster infrastructure's health. We input <kubectl get namespace>, which verifies the deployment locations of workloads and guarantees that resources are appropriately distributed among environments, teams, or system components. We can also add a namespace here with the command <kubectl create namespace <name>>, as shown below.

  1. Deployment of an Application and Testing.

    In order to achieve scalability, high availability, effective resource use, simple management and updates, cloud-native portability, and connection with Azure services, we deploy apps into an AKS cluster. Now there is a need for imperative creation for our deployment, because imperative construction is quick, easy, and suitable for small, one-off contexts or investigation; we employ it for AKS cluster deployment. Afterwards, we often go to declarative approaches (YAML) for automation and production. Now create two deployments by running <kubectl create deployment devapp --image=nginx>, and <kubectl create deployment testapp --image=nginx --replicas3 -n frontend>, making the second deployment connect to the namespace earlier created as shown below.

    Now, to show every Deployment object in the current namespace is to <run kubectl get deployment --namespace frontend>

    By default, a deployment's pods can only be accessed within the cluster (internal networking).
    However, Kubectl exposes a deployment (or creates a service) that makes the application accessible to other VMs/networks (NodePort), the internet (LoadBalancer or Ingress in AKS), or within the cluster (ClusterIP), so to expose the service we will run <kubectl expose deployment testapp --name=nginx-service --type=LoadBalancer --port=80 --protocol=TCP -n frontend> and to further deploy the service created we run <kubectl get service --all-namespaces>.

    At this point, we can view all services and test the application behavior under actual traffic conditions and confirm deployments and networking by using the service name external IP address to confirm on a web browser, as shown below.

  2. Conclusion.

    Organizations may deploy containerized apps in a scalable, secure, and fully managed environment by setting up an Azure Kubernetes Service (AKS) cluster. Because Azure takes care of provisioning, upgrades, and maintenance, teams can concentrate on developing applications rather than maintaining the underlying Kubernetes control plane when they use AKS.
    The basis for dependable and effective application deployment is laid by the AKS cluster setup procedure, which includes defining node pools, configuring the resource group, integrating identity and access controls, and setting up networking. High availability, automated scaling, and smooth integration with other Azure services like storage, security, and monitoring are made possible by the cluster once it is set up.

    Additionally, teams may integrate rolling updates, continuous deployment, and automated monitoring with minimum operational overhead because of AKS's support for contemporary DevOps approaches. Essentially, by leveraging Microsoft Azure's enterprise-grade reliability, deploying an AKS cluster enables enterprises to embrace cloud-native designs, expedite application delivery, and preserve operational efficiency.

    Thank you very much for visiting and reading my site; I hope to see you again soon.

0
Subscribe to my newsletter

Read articles from Gabriel Aboiraor directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Gabriel Aboiraor
Gabriel Aboiraor