STEP 3: SETTING UP AKS STEP-BY-STEP

Published: (December 26, 2025 at 07:01 PM EST)
1 min read
Source: Dev.to

Source: Dev.to

Prerequisites

az version
az login

Step 1: Create AKS Cluster

az aks create \
  --resource-group devops-rg \
  --name myAKSCluster \
  --node-count 2 \
  --enable-addons monitoring \
  --generate-ssh-keys

Step 2: Connect AKS to ACR

az aks update \
  --resource-group devops-rg \
  --name myAKSCluster \
  --attach-acr 

Step 3: Get AKS Credentials for kubectl

az aks get-credentials \
  --resource-group devops-rg \
  --name myAKSCluster

Step 4: Verify Connection

kubectl get nodes

Step 5: Verify Namespaces

kubectl get namespaces

Step 6 (Optional): Enable Autoscaling

az aks update \
  --resource-group devops-rg \
  --name myAKSCluster \
  --enable-cluster-autoscaler \
  --min-count 1 \
  --max-count 5

Step 7: Create Deployment

kubectl create deployment myapp --image=myapp

Step 8: Update & Restart the Deployment Image

Edit the deployment to use your ACR login server image, e.g.:

# In the deployment spec, set:
image: .azurecr.io/myapp:latest

Then restart the deployment:

kubectl rollout restart deployment myapp

Check the pods:

kubectl get pods

Step 9: Expose Deployment

kubectl expose deployment myapp \
  --port=80 \
  --target-port=3000 \
  --type=LoadBalancer

Step 10: Get Services

kubectl get service myapp

Step 11: Test in Browser

Open a web browser and navigate to the external IP address of the myapp service.

Back to Blog

Related posts

Read more »

StatefulSet project

Prerequisites A StatefulSet requires the following components: - Headless Service – provides stable DNS for each pod. - StatefulSet manifest – defines the pods...