๐Ÿงถ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