🧶Creating an Azure Kubernetes Service (AKS) Cluster: A Step-by-Step Guide

Azure Kubernetes Service (AKS) simplifies Kubernetes management tasks, making it easier to deploy, manage, and scale containerized applications using Kubernetes. In this guide, we’ll walk through the process of creating an AKS cluster.

Prerequisites

Sign in to Azure Portal

  1. Open your web browser and navigate to the Azure Portal.

  2. Sign in with your Azure account credentials.

Create a Resource Group

  1. In the Azure Portal, click on “Create a resource” from the left-hand menu.

  2. Search for “Resource group” and select “Resource group” from the results.

  3. Click the “Create” button.

  4. Enter a unique name for your resource group, such as “RKAKSClusterRG

  5. Choose a region for the resource group (e.g., UAE North).

  6. Click the “Review + create” button and then click “Create” to create the resource group.

Create an AKS Cluster

  1. In the Azure Portal, click on “Create a resource” again.

  2. Search for “Kubernetes Service” and select “Kubernetes Service (AKS)” from the results.

  3. Click the “Create” button to start the AKS creation wizard.

Basics

  1. In the “Basics” tab of the AKS creation wizard:

  • Choose your Azure subscription.

  • Select the resource group created before (“RKAKSClusterRG”).

  • Enter a unique name for your AKS cluster (e.g., “RKAKSCluster”).

  • Choose the region for your AKS cluster (e.g., UAE North).

  • Select the desired Kubernetes version (e.g., 1.30.6).

2. Cluster Preset Configuration

  • For practice purposes and development/testing tasks, select a cluster preset configuration that suits your needs, such as “Dev/Test.”

  • This preset can provide you with predefined configurations optimized for these scenarios.

3. Availability Zones

  • Specify the availability zones where your cluster nodes will be placed for increased resiliency.

4. AKS Pricing Tier

  • AKS offers two pricing tiers for the managed Kubernetes control plane. Choose the pricing tier that best meets your needs.

5. Automatic upgrade Type:

  • Choose an upgrade type to determine when the cluster will be upgraded based on new AKS and Kubernetes releases. (For example, you can choose “Enable with Patch” for recommended automatic upgrades.)

6. Authentication and Authorization:

  • For authentication and authorization, you can choose to use local accounts with Kubernetes RBAC. This provides a native Kubernetes RBAC managed locally within your AKS cluster.

Click “Next: Node Pools” to proceed.

Node Pool

  1. You can add or customize node pools based on your application requirements.

  2. Define the number of nodes, VM size, and other settings for your node pool.

Click agentpool and customize

Click “Next: Networking” when you’re ready to proceed.

Networking

  • Configure the networking settings for your AKS cluster. The default settings are usually sufficient for most use cases.

Integrations

  1. Configure integrations with Azure services and features.

  2. You can enable Azure Container Registry integration, Azure Policy, and more.

Click “Next: Monitoring” when you’re done.

Monitoring

  • Enable monitoring if you want to use Azure Monitor and Azure Log Analytics for cluster monitoring and diagnostics.

Click “Next: Security” when you’re done.

Click “Next: Advanced” when you’re done.

Click “Next: Tags” when you’re done.

Tags

  1. Add tags to your AKS cluster for better organization and management.

  2. Click “Review + create” when you’re done.

Review + create

  1. Review all the configuration settings to ensure they are correct.

  2. If everything looks good, click the “Create” button to start the provisioning of the AKS cluster.

Connect to the cluster

Import-AzAksCredential -ResourceGroupName RKAKSClusterRG -Name RKAKSCluster

kubectl get nodes

Deploying Your First Application on AKS

To deploy the application, you use a manifest file to create all the objects required to run the AKS Store application. A Kubernetes manifest file defines a cluster's desired state, such as which container images to run. The manifest includes the following Kubernetes deployments and services:

  • Store front: Web application for customers to view products and place orders.

  • Product service: Shows product information.

  • Order service: Places orders.

  • Rabbit MQ: Message queue for an order queue.

Create a file named aks-store-quickstart.yaml and copy in the following manifest:

  1. For a breakdown of YAML manifest files, see Deployments and YAML manifests.

    If you create and save the YAML file locally, then you can upload the manifest file to your default directory in CloudShell by selecting the Upload/Download files button and selecting the file from your local file system.

  2. Deploy the application using the kubectl apply command and specify the name of your YAML manifest.

kubectl apply -f aks-store-quickstart.yaml

Test the application

Check the status of the deployed pods using the kubectl get pods command. Make all pods are Running before proceeding.

kubectl get pods

Check for a public IP address for the store-front application. Monitor progress using the kubectl get service command with the --watch argument.

Once the EXTERNAL-IP address changes from pending to an actual public IP address, use CTRL-C to stop the kubectl watch process.

Open a web browser to the external IP address of your service to see the Azure Store app in action.

Cheat Sheet - Azure Kubernetes Services

Identity Management

Quickly switch between identites when using AKS with Azure AD integration

kubectl auth whoami 

Node Pool Management

Reboot a node

kubectl get all

kubectl get namespaces

kubectl get configmaps

kubectl get nodes

kubectl get pods

kubectl get rs

kubectl get pods --show-labels

Last updated