Kubernetes is powerful, but building a cluster from scratch means managing control-plane upgrades, etcd and node patching yourself. Azure Kubernetes Service (AKS) removes that burden: Microsoft runs the managed control plane for free and you only pay for the worker nodes. This guide creates an AKS cluster with the Azure CLI and deploys your first application end to end. This article covers AKS Basics in detail.
What You Get with Azure Kubernetes Service – AKS Basics
An AKS cluster gives you a fully managed Kubernetes API server, automated node image upgrades, integration with Microsoft Entra ID for authentication, and native connections to Azure Container Registry, Azure Monitor and Azure load balancers. You bring containers; Azure keeps the platform alive. If you previously experimented locally with our Minikube on Ubuntu guide, AKS is the production-grade next step.
Prerequisites – AKS Basics
- An Azure subscription with quota for at least 2 DS2-size vCPUs in your region
- Azure CLI signed in, plus
kubectl(install it withaz aks install-cli) - Basic knowledge of containers — see our Docker on Ubuntu 24.04 guide if you are new to images
Step 1: Create the AKS Cluster
az group create --name rg-aks-prod --location eastus
az aks create \
--resource-group rg-aks-prod \
--name aks-prod-01 \
--node-count 2 \
--node-vm-size Standard_DS2_v2 \
--generate-ssh-keys
Provisioning takes roughly 5–10 minutes. Two nodes is the practical minimum: with one node, every upgrade or node failure takes your whole workload down.
Step 2: Connect kubectl to Azure Kubernetes Service
az aks get-credentials \
--resource-group rg-aks-prod \
--name aks-prod-01
kubectl get nodes
The first command merges the cluster credentials into your local ~/.kube/config. You should see both nodes in the Ready state.

Step 3: Deploy Your First Application
Create a file named nginx-deployment.yaml:
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
spec:
replicas: 2
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: nginx
image: nginx:1.27
ports:
- containerPort: 80
Apply it and expose the deployment through an Azure load balancer:
kubectl apply -f nginx-deployment.yaml
kubectl expose deployment web --type LoadBalancer --port 80
kubectl get service web --watch
After a minute or two the service receives an EXTERNAL-IP. Open it in a browser and the NGINX welcome page confirms your app is live on Azure Kubernetes Service.
Step 4: Scale and Inspect the Workload
kubectl scale deployment web --replicas=4
kubectl get pods
kubectl describe pod <pod-name>
kubectl logs <pod-name>
Scaling in AKS is instant at the pod level; to grow the cluster itself, use az aks scale --node-count 3 or enable the cluster autoscaler. The Microsoft Learn AKS quickstart covers integrating Azure Container Registry for private images, which is the natural follow-up.
Step 5: Protect the Budget and Clean Up
AKS clusters bill by the node, around the clock, whether or not pods are running. For learning environments, stop the cluster when you are done: az aks stop --resource-group rg-aks-prod --name aks-prod-01 halts the nodes and the control plane billing for compute; az aks start brings everything back with the same configuration. When the experiment is truly finished, deleting the resource group removes every trace: az group delete --name rg-aks-prod --yes --no-wait. In production, the habits that matter most are setting resource requests and limits on every deployment, enabling the cluster autoscaler so node count follows demand, and reviewing the Azure cost analysis blade weekly — a runaway load test left scaling over a weekend is the classic AKS horror story.
What to Learn Next
With a cluster running, three topics unlock real-world workloads. Ingress controllers (such as the NGINX ingress or Azure Application Gateway) give your services clean hostnames and TLS certificates instead of raw load balancer IPs. Helm packages applications like WordPress or Prometheus into one-command installs. And Azure Container Registry keeps your private images inside Azure, integrated with AKS through a managed identity so no registry passwords live in your manifests. Each builds directly on the kubectl workflow you have just practiced.
Step 6: Watch the Cluster’s Health
Before handing the cluster to anyone else, connect it to Azure Monitor for containers. In the portal, open the cluster, choose Insights, and enable monitoring — Azure creates the log pipeline that collects container logs, node CPU and memory, and pod restarts into a Log Analytics workspace. Five minutes later you can answer the questions that matter during an incident: which node is saturated, which pod keeps restarting, and what changed in the last hour. Even without the portal integration, build the habit of running kubectl top nodes and kubectl top pods (backed by the metrics server AKS installs by default) as your first diagnostic step whenever an application feels slow.
Troubleshooting
- Pods stuck in Pending: usually insufficient node CPU or memory. Check
kubectl describe podevents and add nodes or reduce resource requests. - Service has no EXTERNAL-IP: the Azure cloud provider is still provisioning the load balancer. If it stays pending for 10+ minutes, verify the subscription quota and that the cluster’s managed identity can create public IPs.
- ImagePullBackOff: a typo in the image name or a private registry without credentials. Test the image locally with Docker first.
- kubectl points at the wrong cluster: use
kubectl config get-contextsandkubectl config use-contextto switch.
Conclusion
Azure Kubernetes Service turns a weekend of cluster plumbing into two commands. Start with a small two-node cluster, deploy stateless apps first, and add managed disks, ingress controllers and monitoring as your workloads grow.