After provisioning your AKS cluster (including the resource group, virtual network, and other prerequisites), the next step is to connect via Azure CLI and deploy a Dockerized sample application. This guide will walk you through each step—from authentication to exposing your service—using PowerShell examples that apply equally to macOS and Linux terminals.Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
All Azure CLI commands shown here work in Azure Cloud Shell, Windows PowerShell, macOS, and Linux terminals. Replace any Windows-specific paths or syntax as needed on other platforms.
1. Connecting to Your AKS Cluster
You can authenticate and configurekubectl in multiple environments:
| Connection Method | Platform | Pre-installed Tools |
|---|---|---|
| Azure Cloud Shell | Web Browser | kubectl, Azure CLI, PowerShell modules |
| Local PowerShell | Windows | kubectl, Azure CLI |
| Terminal | macOS / Linux | kubectl, Azure CLI |
-
Log in to Azure CLI
-
Verify your active subscription
-
Set a default resource group
-
Download and merge AKS credentials
-
Confirm the current Kubernetes context
2. Inspecting the Cluster State
Before deploying, it’s good practice to confirm that your cluster has no existing workloads:| Command | Purpose |
|---|---|
kubectl get nodes | List all nodes and their status |
kubectl get deployments | Show existing deployments in default ns |
kubectl get pods | Display running pods in default ns |
3. Deploying the Sample Application
We previously built and pushed the Docker imagehpranav/kodekloudappcs:v1 to Docker Hub. Deploy it to AKS with a single replica:
4. Exposing the Deployment via Load Balancer
To allow external access, create a Service of typeLoadBalancer. Azure will provision a cloud load balancer and assign a public IP:
Replace
20.50.123.456 with your actual EXTERNAL-IP. It can take a minute for Azure to provision the public IP.http://20.50.123.456 to verify that the sample application is running on your AKS cluster.