Skip to main content
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.
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 configure kubectl in multiple environments:
  1. Log in to Azure CLI
  2. Verify your active subscription
  3. Set a default resource group
  4. Download and merge AKS credentials
  5. 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:
As expected, there are no deployments or pods at this point.

3. Deploying the Sample Application

We previously built and pushed the Docker image hpranav/kodekloudappcs:v1 to Docker Hub. Deploy it to AKS with a single replica:
Verify that the deployment and pod are running:
You can also view the pod status in the Azure portal under your AKS resource.

4. Exposing the Deployment via Load Balancer

To allow external access, create a Service of type LoadBalancer. Azure will provision a cloud load balancer and assign a public IP:
Retrieve the service details and public IP:
Replace 20.50.123.456 with your actual EXTERNAL-IP. It can take a minute for Azure to provision the public IP.
Open your browser to http://20.50.123.456 to verify that the sample application is running on your AKS cluster.

Watch Video