0
0
Azurecloud~10 mins

Deploying workloads to AKS in Azure - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Deploying workloads to AKS
Write Kubernetes YAML manifest
Connect to AKS cluster
Run kubectl apply -f manifest
Kubernetes API receives manifest
Scheduler assigns pods to nodes
Pods start running workload
Check pod status and logs
Workload deployed and accessible
This flow shows how a workload defined in a YAML file is deployed step-by-step to an AKS cluster using kubectl.
Execution Sample
Azure
apiVersion: v1
kind: Pod
metadata:
  name: myapp-pod
spec:
  containers:
  - name: myapp
    image: nginx
This YAML defines a simple pod running an nginx container to be deployed on AKS.
Process Table
StepActionInput/CommandResult/State Change
1Write manifestYAML pod definitionPod manifest ready to deploy
2Connect to AKSaz aks get-credentialskubectl configured to AKS cluster
3Deploy workloadkubectl apply -f pod.yamlAPI server receives pod manifest
4Schedule podKubernetes schedulerPod assigned to a node
5Start podKubelet on nodeContainer starts running nginx
6Check statuskubectl get podsPod status is Running
7Check logskubectl logs myapp-podNginx logs displayed
8Access workloadcurl pod IP or serviceNginx welcome page served
9ExitWorkload runningDeployment complete and stable
💡 Workload is deployed and running successfully on AKS cluster
Status Tracker
VariableStartAfter Step 3After Step 4After Step 5Final
Pod ManifestNot createdCreated and appliedScheduled to nodeRunning containerRunning pod
kubectl ContextNot setSet to AKS clusterSameSameSame
Pod StatusNonePendingScheduledRunningRunning
Key Moments - 3 Insights
Why does the pod status show 'Pending' after applying the manifest?
After applying the manifest (Step 3), the pod is created but not yet scheduled to a node. It stays 'Pending' until the scheduler assigns it (Step 4).
What happens if kubectl is not configured to the AKS cluster?
If kubectl context is not set (Step 2), the apply command will fail because it cannot reach the AKS API server to deploy the workload.
How do we verify the workload is running correctly?
By checking pod status (Step 6) and viewing logs (Step 7), we confirm the container is running and serving as expected.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the pod status immediately after Step 3?
APending
BRunning
CSucceeded
DFailed
💡 Hint
Check the 'Pod Status' variable in variable_tracker after Step 3
At which step does the pod get assigned to a node?
AStep 2
BStep 4
CStep 3
DStep 5
💡 Hint
Look at the 'Action' column in execution_table for scheduling
If kubectl is not connected to AKS, what will happen at Step 3?
APod will be scheduled anyway
BPod will start running locally
Ckubectl apply will fail
DPod status will be Running
💡 Hint
Refer to key_moments about kubectl context configuration
Concept Snapshot
Deploying workloads to AKS:
- Write Kubernetes YAML manifest (pods, deployments)
- Connect kubectl to AKS cluster (az aks get-credentials)
- Run 'kubectl apply -f manifest.yaml' to deploy
- Kubernetes schedules pods to nodes
- Pods start containers and run workload
- Check status with 'kubectl get pods'
- View logs with 'kubectl logs <pod>'
Full Transcript
To deploy workloads to AKS, first write a Kubernetes YAML manifest describing your pod or deployment. Then connect your kubectl tool to the AKS cluster using 'az aks get-credentials'. Next, deploy the workload by running 'kubectl apply -f' with your manifest file. The Kubernetes API server receives this manifest and creates the pod resource. The scheduler assigns the pod to a node, where the kubelet starts the container. You can check the pod status with 'kubectl get pods' and view logs with 'kubectl logs'. Once the pod is running, your workload is deployed and accessible.