Beginner's Guide to Azure Kubernetes Service (AKS) using PowerShell: Creating a Cluster and Deploying an Application

July 12, 2025

Cloud computing has a superhero: Azure Kubernetes Service (AKS). It's like a mighty castle where tiny applications live and work. This guide will help us create this awesome castle and send our little apps inside to do their magic!

Step 1: Set Up Azure CLI and Log in to Azure

Before we begin the AKS adventure, make sure you've got the Azure CLI on your computer. If it's not there, no worries! You can find easy instructions to install it right here. Once it's all setup, use the 'az login' command to step into your Azure account:

az login

Step 2: Create a Resource Group

Azure likes to keep things tidy in what it calls 'resource groups.' Our first task is to make a special group to hold our AKS castle. You can give it any unique name you want! Just type in this command:

az group create --name YourResourceGroupName --location eastus

Remember, choose the location closest to you! To learn more about these locations, check out this link: Azure Regions List

Step 3: Deploy the AKS Cluster

Time to make our AKS castle! Choose a fun name! This command brings the castle to life with two guards (nodes) and special magic for watching over things (monitoring)

az aks create --resource-group YourResourceGroupName --name YourAKSClusterName --node-count 2 --enable-addons monitoring --generate-ssh-keys

Step 4: Connect to the Cluster

To interact with the AKS cluster, configure kubectl, the Kubernetes command-line tool, to connect to the newly created AKS cluster:

az aks get-credentials --resource-group YourResourceGroupName --name YourAKSClusterName

This command sets up authentication and configures kubectl to communicate with your AKS cluster.

Step 5: Deploy an Application to AKS

Let's invite a friend to our castle! We'll call our buddy NGINX, a cool web server. With this command, we'll welcome NGINX inside our castle walls.

kubectl create deployment sample-web --image=nginx:latest

This deploys the NGINX web server within the AKS cluster.

Step 6: Expose the Application

Next, let’s expose the NGINX deployment using a Kubernetes service to make it accessible from outside the AKS cluster. Run the following command:

kubectl expose deployment sample-web --port=80 --target-port=80 --type=LoadBalancer

This command exposes the NGINX deployment via a LoadBalancer service, providing an external IP for access.

Step 7: Access the Deployed Application

To access the deployed NGINX web server, retrieve the external IP assigned to the sample-web service:

kubectl get service

Look for the external IP and access the NGINX web server via a web browser using that IP

Article content
Screenshot displaying the NGINX application successfully deployed within the Azure Kubernetes Service (AKS) cluster.

Congratulations! You’ve successfully created an AKS cluster, deployed a sample application (NGINX), and accessed it. This guide serves as a starting point for leveraging AKS to deploy and manage your containerized applications on Azure. Remember, you can deploy various applications using this foundation.

Step 8: Tidying Up - Deleting Our Azure Creations

Part A: Removing the NGINX Application

First, we need to remove the NGINX application from our AKS cluster to prepare for its deletion.

kubectl delete deployment sample-web

Part B: Deleting the AKS Cluster

Now, it's time to say goodbye to our AKS castle. This will remove the AKS cluster and associated resources.

az aks delete --resource-group YourResourceGroupName --name YourAKSClusterName

Part C: Deleting the Resource Group

We've completed our adventure, and it's time to remove the resource group that sheltered our castle and associated resources.

az group delete --name YourResourceGroupName --yes --no-wait

Using the castle analogy in this article wasn't just for fun - it's about making this complex process memorable.

Our minds often retain information better when associated with familiar, vivid images or stories.

The castle idea helps change a complicated cloud service setup into a story that's easy to remember and understand.

Article content

Remembering how to create an AKS cluster or deploy applications can be easier when linked to a vivid concept like a castle. The human mind has an incredible capacity to recall stories and visuals, which is why relating technical tasks to imaginative scenarios can make learning more engaging and, most importantly, unforgettable.

Ready to Finally Feel Safe Online?

Whether it’s your team, your content, or your digital identity — I’ll help you lock it down with clarity, not complexity.
Book Your Free Call Now

The Premium Weekend
Cybersecurity Services

Weekend-Only Expert Cybersecurity Audits

Let’s Get Social

lockselectthumbs-up linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram