AKS Hour 6: Upgrades, Observability and Day-2 Operations
- Understand the AKS version support policy: N-2 community support, N-3 platform support + 60-day grace period, LTS (Premium tier), and platform-initiated upgrades starting 2027-06-01. Be able to design an organization-wide upgrade strategy based on “environment tiers + cadence.”
- Master a real node pool upgrade: surge node → cordon → drain (Eviction API, subject to PDBs) → soak → reimage → uncordon / become the buffer node for the next batch. Know how to tune
--max-surge,--max-unavailable,--drain-timeout,--node-soak-durationand--undrainable-node-behavior. - Distinguish three kinds of operations: control plane upgrades, node pool upgrades and node image upgrades. Perform blue-green node pool migrations and
az aks nodepool rollback(within 7 days), and understand that the control plane cannot be downgraded. - Configure the auto-upgrade channel for the cluster (patch / stable / rapid) and the node OS upgrade channel (NodeImage / SecurityPatch / Unmanaged / None), and use
aksManagedAutoUpgradeScheduleandaksManagedNodeOSUpgradeScheduleto confine them to maintenance windows. - Enable Container Insights + Managed Prometheus. Configure diagnostic settings to send control plane logs (kube-apiserver, kube-audit-admin, etc.) to Log Analytics in resource-specific mode, and use KQL to answer “who changed what, and when.”
- Enable the cost analysis add-on to allocate costs by namespace. Use day-to-day operations such as
az aks stop/startandaz aks rotate-certscorrectly, and know their downtime impact and limits.
1-hour timetable
| # | Timing | Module | Core content | Animation / interaction | Lab (aks-lab-ops cluster) |
|---|---|---|---|---|---|
| 0 | Before class | Setup: multi-node-pool sample cluster | Create a Standard tier cluster on 1.35 (system + user pools), deploy myapp + PDB + availability prober | Environment self-check list | Cluster, myapp and PDB ready |
| 1 | 00–06 | Kubernetes versions and upgrade strategy | N-2, patch lifecycle, N-3 platform support and 60-day grace period, platform-initiated upgrades, LTS, cross-version rules, version skew, deprecated APIs | Support window simulator: pick a version + date → support status | get-upgrades + deprecated API check |
| 2 | 06–13 | Control plane and node pool upgrades | control-plane-only, max surge / max unavailable, drain timeout, soak, undrainable nodes, forced upgrade, blue-green node pools, rollback limits | Core animation: surge upgrade (cordon → drain subject to PDB → reimage → uncordon) | 1.35 → 1.36: control plane first, then upgrade pool by pool and test availability |
| 3 | 13–21 | Node images, auto-upgrade channels and maintenance windows | Weekly node image updates, --node-image-only, cluster auto-upgrade channels, node OS channels, three maintenance configuration types; platform-initiated upgrades are not bound by windows | “One-week timeline” simulation: release → channel → window → execution | Configure stable + NodeImage and two windows |
| 4 | 21–28 | Container Insights and Managed Prometheus | ama-logs / ama-metrics architecture, DCR, ContainerLogV2, cost presets, control plane metrics, Grafana | Metrics and log data flow animation | Enable both and verify the agents and data |
| 5 | 28–35 | Logs, diagnostic settings and control plane logs | Resource log categories, resource-specific mode, AKSAudit / AKSAuditAdmin / AKSControlPlane, Basic logs, upgrade events | The audit log journey of a single kubectl delete | Diagnostic settings + KQL audit queries |
| 6 | 35–42 | Cost analysis add-on and optimization | OpenCost basics, prerequisites and limits, idle / system / service / unallocated, optimization techniques | Node cost allocation calculator based on requests | Enable cost analysis + apply labels |
| 7 | 42–50 | Stop/start, certificate rotation and day-to-day maintenance | stop/start limits, certificate types and validity periods, rotate-certs downtime, KSCR, daily checks | Stop/start and certificate rotation state machine | stop/start + check certificate expiry |
| 8 | 50–60 | Operations review | Upgrade readiness review, runbooks, alert baseline, drills, upgrade failure troubleshooting | Operations maturity scorecard + upgrade troubleshooting tree | Produce a review report |
| — | After class | Cheat sheet · Capstone lab | Complete an auditable, reversible upgrade on the “production candidate” cluster | Final quiz (12 questions) | Capstone lab |
Knowledge Coverage Matrix
| Target skill | M1 | M2 | M3 | M4 | M5 | M6 | M7 | M8 | Key commands | Lab |
|---|---|---|---|---|---|---|---|---|---|---|
| Determine version support status and plan upgrades | ✓ | · | ✓ | · | · | · | · | ✓ | az aks get-versions, get-upgrades | M1 |
| Upgrade the control plane and node pools with low disruption | · | ✓ | ✓ | · | · | · | · | ✓ | az aks upgrade --control-plane-only, nodepool upgrade | M2 |
| Protect workloads with PDBs and drain parameters | · | ✓ | · | · | · | · | ✓ | ✓ | --drain-timeout, --undrainable-node-behavior | M2 |
| Blue-green node pools and rollback | · | ✓ | · | · | · | · | · | ✓ | nodepool add, nodepool rollback | M2 |
| Auto-upgrade channels and maintenance windows | ✓ | · | ✓ | · | · | · | · | ✓ | --auto-upgrade-channel, maintenanceconfiguration add | M3 |
| Metrics and container logs | · | · | · | ✓ | ✓ | · | · | ✓ | --enable-azure-monitor-metrics, enable-addons -a monitoring | M4 |
| Control plane logs and audit | · | · | · | · | ✓ | · | · | ✓ | az monitor diagnostic-settings create | M5 |
| Cost allocation and optimization | · | · | · | ✓ | ✓ | ✓ | ✓ | · | --enable-cost-analysis | M6 |
| Stop/start, certificates and day-to-day maintenance | · | · | · | · | · | ✓ | ✓ | ✓ | az aks stop/start, rotate-certs | M7 |
What this hour does not cover (and where to learn it)
| Topic | Why it is not in this hour | Where to learn it |
|---|---|---|
| General Kubernetes concepts such as PDBs, drain and rolling updates | This hour only covers how AKS uses them | Kubernetes Hour 2; for AKS basics, see Kubernetes Hour 6 |
| PromQL, recording rules, alerting rules, Grafana dashboard details | Belongs to the Prometheus course topics | Prometheus & Grafana Hour 3 (Managed Prometheus) |
| Fleet Manager multi-cluster staged updates, GitOps-driven upgrades | Covered in the previous hour | AKS Hour 5 |
| Cluster Autoscaler, NAP, VPA, Spot node pools | Belongs to the scaling topic (this hour only references it in the cost module) | AKS Hour 4 |
| In-depth troubleshooting of SNAT port exhaustion, subnet IP exhaustion and DNS failures | Belongs to the in-depth troubleshooting topic | AKS Hour 7 |
| Azure Backup for AKS, disaster recovery | Beyond 1 hour | Azure Backup for AKS documentation |
How to use this course material
Principles · diagrams · animation · commands · lab · production cases · troubleshooting · quiz · voice · video. Read “Principles” and “Animation” first, then do the “Lab” hands-on. The surge upgrade animation in module 2 is the core of this hour.
A module counts toward progress once you score ≥ 70% on its quiz or click “Mark module complete.” Progress is saved in this browser's localStorage (it is cleared on refresh if local storage is disabled).
The “Voice” tab reads the narration script aloud using the browser's built-in Web Speech API (en-US). If no English voice pack is installed, the script can still be read or passed to another TTS tool.
az aks nodepool rollback) is GA (requires Azure CLI 2.88.0+ and API 2026-04-01+); the blue-green node pool upgrade strategy is still in Preview. All commands are written against the current learn.microsoft.com documentation. The commands in this course material were not run on a real subscription; outputs are marked as examples. See the “Known limitations” on the sources page for details.Module 0 · Setup: multi-node-pool sample cluster (complete before class)
- Completed Hour 1 (familiar with
az aks create, node pools and kubeconfig) and Hour 4 (node pools and scaling). - Azure CLI 2.88.0 or later (required for node pool rollback; check with
az version), kubectl and kubelogin (az aks install-cli). - Azure roles: on
rg-aks-lab, at least Contributor (to create the cluster and diagnostic settings); viewing cost analysis requires subscription-level Reader or Cost Management Reader; granting ACR access requires Owner or User Access Administrator. - Sample application: myapp from the Docker course (Flask + gunicorn + Redis, port 5000,
/healthz, imagemyapp:1.0), already pushed to ACRacraks<suffix>in Hour 1.
Connection to the previous hour
In Hour 5 we managed aks-lab with IaC / GitOps. This hour does not run upgrade experiments on aks-lab (it may already be on the latest version and hosts resources for other hours). Instead, following course convention, we create a dedicated cluster, aks-lab-ops, pinned to 1.35 so we can rehearse the full 1.35 → 1.36 path. Variables follow the shared convention:
RG=rg-aks-lab; LOC=canadacentral; CLUSTER=aks-lab
OPS=aks-lab-ops # dedicated cluster for this hour
ACR=$(az acr list -g $RG --query "[0].name" -o tsv) # reuse acraks<suffix> from Hour 1
echo "ACR=$ACR"
az account show --query "{sub:name, user:user.name}" -o table
Step 1: List regional versions and create the 1.35 cluster
az aks get-versions -l $LOC -o table az group create -n $RG -l $LOC # no effect if it already exists az aks create -g $RG -n $OPS -l $LOC \ --tier standard \ --kubernetes-version 1.35 \ --nodepool-name systempool --node-count 2 --node-vm-size Standard_D4s_v5 \ --network-plugin azure --network-plugin-mode overlay \ --enable-managed-identity --generate-ssh-keys \ --auto-upgrade-channel none --node-os-upgrade-channel None \ --attach-acr $ACR
KubernetesVersion Upgrades ------------------- ------------------------ 1.37.1 None available 1.36.5 1.37.1 1.35.9 1.36.5 ... "currentKubernetesVersion": "1.35.9", "provisioningState": "Succeeded",
--kubernetes-version 1.35: when only the minor version is given, AKS uses the latest GA patch of that minor (the example in this text is 1.35.9).--tier standard: the cost analysis add-on in module 6 does not support the Free tier.- Turn off both auto-upgrade channels first (
none/None); module 3 turns them on according to your policy. Otherwise the platform might upgrade the cluster before the experiments begin.
Step 2: Add the user node pool and set upgrade parameters
az aks nodepool add -g $RG --cluster-name $OPS -n apppool \
--mode User --node-count 3 --node-vm-size Standard_D4s_v5 \
--kubernetes-version 1.35 \
--max-surge 1 --drain-timeout 15 --node-soak-duration 2
az aks nodepool list -g $RG --cluster-name $OPS \
--query "[].{name:name,mode:mode,ver:currentOrchestratorVersion,count:count,surge:upgradeSettings.maxSurge,drain:upgradeSettings.drainTimeoutInMinutes}" -o table
Name Mode Ver Count Surge Drain ---------- ------ ------ ------- ------- ------- systempool System 1.35.9 2 10% None apppool User 1.35.9 3 1 15
Note: what maxSurge shows for systempool depends on the API version used at creation time and on CLI defaults (the docs state both “default 1 node” and “usually 10%”). Use the actual values from az aks nodepool show; for production, explicitly set it to 33%.
Step 3: Deploy myapp + Redis + PDB + availability prober
az aks get-credentials -g $RG -n $OPS --overwrite-existing
kubectl create namespace myapp
cat <<EOF | kubectl apply -n myapp -f -
apiVersion: apps/v1
kind: Deployment
metadata: {name: redis}
spec:
replicas: 1
selector: {matchLabels: {app: redis}}
template:
metadata: {labels: {app: redis}}
spec:
nodeSelector: {kubernetes.azure.com/mode: user}
containers:
- name: redis
image: redis:7-alpine
ports: [{containerPort: 6379}]
---
apiVersion: v1
kind: Service
metadata: {name: redis}
spec: {selector: {app: redis}, ports: [{port: 6379}]}
---
apiVersion: apps/v1
kind: Deployment
metadata: {name: myapp}
spec:
replicas: 4
selector: {matchLabels: {app: myapp}}
template:
metadata: {labels: {app: myapp}}
spec:
nodeSelector: {kubernetes.azure.com/mode: user}
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: ScheduleAnyway
labelSelector: {matchLabels: {app: myapp}}
containers:
- name: myapp
image: $ACR.azurecr.io/myapp:1.0
env: [{name: REDIS_HOST, value: redis}]
ports: [{containerPort: 5000}]
readinessProbe: {httpGet: {path: /healthz, port: 5000}, periodSeconds: 5}
resources: {requests: {cpu: 100m, memory: 128Mi}, limits: {memory: 256Mi}}
---
apiVersion: v1
kind: Service
metadata: {name: myapp}
spec: {selector: {app: myapp}, ports: [{port: 80, targetPort: 5000}]}
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata: {name: myapp-pdb}
spec:
maxUnavailable: 1
selector: {matchLabels: {app: myapp}}
EOF
kubectl get deploy,pdb,pod -n myapp -o wide
NAME READY UP-TO-DATE AVAILABLE deployment.apps/myapp 4/4 4 4 deployment.apps/redis 1/1 1 1 NAME MIN AVAILABLE MAX UNAVAILABLE ALLOWED DISRUPTIONS poddisruptionbudget.policy/myapp-pdb N/A 1 1
The myapp image comes from the ACR where it was pushed in Hour 1. If myapp:1.0 is not in ACR, run az acr build -r $ACR -t myapp:1.0 . in the myapp directory of the Docker course. Redis has only 1 replica and no PDB; this is an intentional single point of failure, and module 2 will show its disruption during drain.
Step 4: Start the availability prober (keep it running throughout the course)
kubectl run prober -n myapp --image=curlimages/curl:8.11.1 --restart=Never \
--overrides='{"spec":{"nodeSelector":{"kubernetes.azure.com/mode":"system"}}}' \
--command -- sh -c 'while true; do c=$(curl -s -o /dev/null -m 2 -w "%{http_code}" http://myapp.myapp/healthz); echo "$(date +%T) $c"; sleep 1; done'
kubectl logs -n myapp prober -f | grep -v " 200$" # show only the seconds that are not 200
The prober runs on the system pool so it does not get evicted during the apppool upgrade. It is a standalone pod; az aks stop in module 7 will delete it, so it will need to be recreated then.
Costs, permissions and security
az aks stop -g $RG -n $OPS (module 7); clean up at the end of the course.kube-audit-admin: audit logs contain usernames, source IPs and request objects, so grant access to the Log Analytics workspace on a least-privilege basis. Do not enable any “bypass protection” parameter other than --enable-force-upgrade on the lab cluster and then forget to revert it.# Course cleanup (delete only this hour's cluster; keep aks-lab and ACR) az aks delete -g $RG -n $OPS --yes --no-wait # If the whole resource group is no longer needed: # az group delete -n $RG --yes --no-wait
Self-check list
Module 1 · Kubernetes versions and upgrade strategy
- Explain AKS's three support states: community support (N-2), platform support (N-3, including the 60-day grace period) and unsupported; and how LTS extends the support period by one year.
- Know the patch lifecycle (at least two months), the regional rollout of releases (up to about 10 business days), and that new clusters default to N-1.
- Master the upgrade rules: non-LTS versions cannot skip minor versions; LTS can upgrade across minors to a higher LTS; the control plane can lead node pools by at most 3 minor versions; node pools cannot be higher than the control plane.
- Design an upgrade strategy for an organization: environment tiers (dev → staging → prod), cadence (monthly patches, quarterly minors), deprecated API checks and a rollback plan.
What: the AKS version support policy
The Kubernetes community releases a minor version roughly every 4 months (e.g., 1.36 → 1.37), and each minor is maintained upstream for about a year. AKS divides this into several states:
| State | Scope | What you get | What you cannot do |
|---|---|---|---|
| Community support | Latest GA version N and N-1, N-2 (currently 1.37 / 1.36 / 1.35) | Patches, bug fixes and full technical support; you can create clusters and node pools | — |
| Platform support | N-3 (currently 1.34; community support ends in 2026-11) | Supports only Azure platform-related issues; upgrade yourself within the 60-day grace period | Cannot create new clusters on this version; Kubernetes component issues are not supported |
| Unsupported | N-4 and older | No security patches; subject to platform-initiated upgrades starting 2027-06-01 | Most operations are restricted |
| LTS (Long-Term Support) | All supported versions can opt in; requires the Premium tier + --k8s-support-plan AKSLongTermSupport | Community support 1 year + LTS 1 year ≈ 24 months; only the two most recent patches are supported | Not added automatically; some add-ons (such as the Microsoft-managed Calico) do not support LTS |
Current calendar (verified 2026-11):
| Version | AKS GA | Community support ends | LTS ends | Planned platform-initiated upgrade month |
|---|---|---|---|---|
| 1.34 | 2025-11 | 2026-11 | 2027-11 | 2027-06 (non-LTS) |
| 1.35 | 2026-03 | 2027-03 | 2028-03 | 2027-06 (non-LTS) |
| 1.36 | 2026-06 | 2027-06 | 2028-06 | 2027-09 (non-LTS) |
| 1.37 | 2026-10 | 2027-10 | 2028-10 | 2028-01 (non-LTS) |
| 1.38 | 2027-02 (planned) | TBD | TBD | TBD |
“Community support ends” refers to the last day of that month. “Planned platform-initiated upgrade month” is an estimate from official planning; AKS throttles by region, subscription and version, so the actual upgrade may happen later than that month.
Why: why upgrading must be routine work
- Security: patch versions fix CVEs; once a version is unsupported, it receives no more patches.
- Loss of control: platform-initiated upgrades ignore maintenance windows, do not stop for deprecated APIs, and can override PDBs that block drain. “Not upgrading” ends up as “being upgraded at a time you did not choose.”
- Features and add-ons: new add-on versions are tied to Kubernetes versions (for example, LocalDNS is enabled by default in 1.37+, and Windows Server 2022 is no longer supported in 1.37+).
How: upgrade rules
- Non-LTS cannot skip minors: 1.35 → 1.36 → 1.37, one step at a time.
- LTS → higher LTS can skip: provided the target version is still offered in AKS and passes the version skew and validation checks.
- Recovery path for unsupported versions: only a full cluster upgrade to the lowest supported version is possible (control-plane-only is not allowed).
- Version skew: the control plane must be ≥ all node pools; since 1.28 the control plane can lead node pools by at most 3 minor versions (e.g., with the control plane on 1.35, node pools can be 1.32–1.35).
- No downgrades: the control plane cannot be rolled back. Within 7 days after a node pool upgrade, you can use
az aks nodepool rollbackto return the pool to the previous version (module 2). - Patches: once a patch is offered, it has a lifecycle of at least two months. Removed patches have a 60-day upgrade period, but after removal they can no longer be used to create new clusters or node pools.
When: recommended upgrade cadence
| Type | Cadence | Lever |
|---|---|---|
| Node image / OS security patches | Weekly | Node OS channel NodeImage or SecurityPatch + weekly maintenance window (module 3) |
| Kubernetes patches | Monthly | patch channel, or az aks upgrade in a pipeline |
| Kubernetes minor | Every quarter to every half year, staying near N-1 | stable channel + monthly maintenance window; or advance manually by environment ring. For multiple clusters, use Fleet (Hour 5) |
Comparison: version policies of AKS / EKS / GKE (conceptual comparison)
| Dimension | AKS | EKS | GKE |
|---|---|---|---|
| Standard support window | N-2, about 12 months | About 14 months of standard support | About 14 months |
| Extended support | LTS (Premium tier, +12 months) | Extended support (extra charges) | Extended channel |
| After expiry | Platform-initiated upgrade after the 60-day grace period (from 2027-06) | Automatic upgrade at expiry | Auto-upgrade |
| Auto-upgrade | Channel + maintenance configuration | Managed node groups must be triggered manually (Auto Mode is an exception) | Release channel + maintenance window |
The EKS and GKE columns are for conceptual comparison only; check each provider's official documentation for exact durations.
none, so AKS will never upgrade my cluster.” — Wrong. After expiry + the 60-day grace period, platform-initiated upgrades happen regardless of the channel. ② “The default version in the portal is the latest.” — The default is N-1. ③ “LTS is free.” — LTS requires the Premium tier (for when Premium billing starts after community support ends, refer to the pricing page and release notes). ④ “You can upgrade node pools before the control plane.” — No; the control plane must be ≥ the node pools.Timeline: the life of a minor version in AKS
Upgrade paths and version skew
Interactive simulator: what is this cluster's support status right now?
Choose the cluster version and whether LTS is enabled, then drag the “date.” The simulator calculates the status from the official calendar and gives the command you should run at that point. Months are counted as end-of-month, and the 60-day grace period is approximated as 2 months.
Core commands
| Command | Purpose | Key parameters / notes |
|---|---|---|
az aks get-versions -l LOC | Available versions and upgrade paths in a region | -o table; LTS version markers are in the JSON under capabilities.supportPlan |
az aks get-upgrades | Upgrade targets for a given cluster | Control plane targets; for node pools, use az aks nodepool get-upgrades |
az aks show --query currentKubernetesVersion | Current full version (including patch) | kubernetesVersion may only be a minor alias |
az aks update --tier premium --k8s-support-plan AKSLongTermSupport | Join LTS | Configuration change, no node recreation; also recommended: --auto-upgrade-channel patch |
az aks update --tier free --k8s-support-plan KubernetesOfficial | Leave LTS | Can only leave while the version is still in community support |
az aks get-upgrades -g $RG -n $OPS -o table
az aks nodepool get-upgrades -g $RG --cluster-name $OPS --nodepool-name apppool -o table
az aks show -g $RG -n $OPS --query "{cp:currentKubernetesVersion, tier:sku.tier, plan:supportPlan, auto:autoUpgradeProfile}" -o json
Name ResourceGroup MasterVersion Upgrades
------- --------------- --------------- --------
default rg-aks-lab 1.35.9 1.36.5
{
"auto": { "nodeOsUpgradeChannel": "None", "upgradeChannel": "none" },
"cp": "1.35.9",
"plan": "KubernetesOfficial",
"tier": "Standard"
}
How to verify: Upgrades lists only one minor (1.36.x), which confirms “non-LTS cannot skip minors.” Common mistake: treating the output of az aks get-versions as the upgrade targets for this cluster. It is a regional view and does not consider your current version. Production use: in a pipeline, compare the output of get-upgrades against an internal allowed-versions list to prevent anyone from upgrading directly to a version that has just reached GA.
Check for deprecated and removed APIs
# 1) Portal: Cluster → Upgrades; when you select the target version, APIs that will be removed are highlighted # 2) Command line: kube-no-trouble (kubent) scans the resources visible in the current kubeconfig kubent --target-version 1.36.0 # 3) You can also check the apiserver deprecated API usage metric directly (requires permission to read /metrics) kubectl get --raw /metrics | grep apiserver_requested_deprecated_apis
>>> Deprecated APIs removed in 1.36 <<< KIND NAMESPACE NAME API_VERSION REPLACE_WITH (SINCE) (none) — if empty, the current manifests contain no APIs that will be removed
AKS's pre-upgrade validation also checks for deprecated APIs (“API breaking changes”). If it detects a recently used API that is about to be removed, it blocks the upgrade (for this behavior and how to override it, see --enable-force-upgrade in module 2). Platform-initiated upgrades skip this check.
Enable LTS for a production cluster (example; incurs Premium tier charges, not executed in this lab)
az aks update -g $RG -n $CLUSTER --tier premium --k8s-support-plan AKSLongTermSupport --auto-upgrade-channel patch
Lab 1: Assess the upgrade path of aks-lab-ops (read-only, about 5 min)
Goal: confirm the current version status, available upgrade targets and deprecated APIs, and write an upgrade plan. Environment: aks-lab-ops from module 0. Cost: no additional cost.
az aks get-versions -l $LOC -o table
Record the latest GA version (N), the default version, and how many minors behind N your version is.
az aks get-upgrades -g $RG -n $OPS -o table
for p in systempool apppool; do az aks nodepool get-upgrades -g $RG --cluster-name $OPS --nodepool-name $p --query "{pool:'$p', latestImage:latestNodeImageVersion}" -o tsv; donekubent --target-version 1.36.0 || echo "kubent not installed: check the Upgrades page in the portal instead"
kubectl version -o yaml | grep gitVersion kubectl get nodes -L agentpool -o custom-columns=NAME:.metadata.name,POOL:.metadata.labels.agentpool,KUBELET:.status.nodeInfo.kubeletVersion
NAME POOL KUBELET aks-apppool-12345678-vmss000000 apppool v1.35.9 aks-apppool-12345678-vmss000001 apppool v1.35.9 aks-apppool-12345678-vmss000002 apppool v1.35.9 aks-systempool-87654321-vmss000000 systempool v1.35.9 aks-systempool-87654321-vmss000001 systempool v1.35.9
--max-surge 1 --drain-timeout 15 --node-soak-duration 2; acceptance: the prober shows no non-200 responses lasting more than 5 consecutive seconds; rollback: az aks nodepool rollback within 7 days; the control plane cannot be rolled back.Verify: you can answer “why does get-upgrades only offer 1.36.x?” and “what happens if it is now 2027-07 and the cluster is still on 1.35?” Cleanup: none.
Case 1: a “shadow cluster” nobody has managed for a year
Problem: a team's PoC cluster is still on 1.32 and has left platform support. Approach: perform a full cluster upgrade to the lowest supported version via the recovery path (control-plane-only is not allowed). First use kubent to clean up removed APIs such as flowcontrol.apiserver.k8s.io/v1beta3, then upgrade step by step. Configuration: right after the upgrade, set the stable channel and a monthly maintenance window. Limitation: for a cluster that is clearly far behind, creating a new cluster and migrating (a blue-green cluster) is often safer.
Case 2: compliance requires “the version does not change for a year”
Problem: a regulated business needs re-certification for every minor upgrade. Approach: enroll production clusters in LTS (Premium tier), keep applying patches through the patch channel, and do one LTS → LTS skip upgrade per year. Limitations: LTS only supports the two most recent patches; the Microsoft-managed Calico does not support LTS (it returns LTSUnsupportedAddon).
Case 3: ring-based upgrades
Problem: 40 clusters across multiple teams. Approach: the dev ring uses rapid, staging uses stable, and prod uses Fleet Manager update runs that advance in stages, with waits and health checks between stages (Hour 5). Limitation: do not configure Fleet auto-upgrade and the cluster's own channel at the same time, to avoid two orchestrators competing for the same cluster.
Common errors and fixes
Node pool creation fails with a version-not-supported error: Version 1.33.x is not supported in this region (illustrative; the error code follows the actual output)
Cause: the version is no longer on the regional support list (versions in platform support cannot be used to create new clusters or node pools), or the patch has been removed.
az aks get-versions -l $LOC -o table
Fix: choose a version from the list. Specifying only the minor (e.g., 1.36) lets AKS pick the latest patch.
Skipping a minor during upgrade is rejected: Upgrading Kubernetes version 1.35.9 to 1.37.1 is not allowed. Available upgrades: 1.36.5 (illustrative)
Cause: non-LTS clusters cannot skip minor versions.
Fix: upgrade to 1.36.x first, then to 1.37.x. If you really need to skip, evaluate LTS or create a new cluster and migrate.
"code": "ValidationError", "message": "Control Plane upgrade is blocked due to recent usage of a Kubernetes API deprecated in the specified version..." "subcode": "UpgradeBlockedOnDeprecatedAPIUsage"
Cause: the pre-upgrade validation for a minor upgrade (target ≥ 1.26) found that, within the last 12 hours, a client made write operations using an API that the target version removes. Get/List/Watch are not counted; AKS records this once per hour.
kubent --target-version 1.36.0 kubectl get --raw /metrics | grep apiserver_requested_deprecated_apis # Portal: Diagnose and solve problems → Create, Upgrade, Delete, and Scale → Kubernetes API deprecations
Fix (recommended): update the manifests and Helm charts, then retry once the last use is more than 12 hours old. Bypass: az aks upgrade ... --enable-force-upgrade --upgrade-override-until 2026-11-20T13:00:00Z (if omitted, the default is 3 days). Note that a forced upgrade also bypasses PDB constraints (module 2).
Upgrading a node pool first is rejected: node pool version cannot be greater than control plane version (illustrative)
Cause: an attempt to upgrade the node pool first.
Fix: run az aks upgrade --control-plane-only first, then upgrade the node pool.
1. Use one command to output the control plane version, pricing tier, support plan and both auto-upgrade channels.
az aks show -g $RG -n $OPS --query "{cp:currentKubernetesVersion,tier:sku.tier,plan:supportPlan,ch:autoUpgradeProfile.upgradeChannel,os:autoUpgradeProfile.nodeOsUpgradeChannel}" -o table2. List each node's kubelet version and its node pool, and confirm that no version skew rule is violated.
kubectl get nodes -o custom-columns=NAME:.metadata.name,POOL:.metadata.labels.agentpool,VER:.status.nodeInfo.kubeletVersion
It is now 2027-04. A production cluster is on 1.35 (non-LTS) and its auto-upgrade channel is none. The team says, “Peak season runs until 2027-08, and we don't want to touch anything.” What would you recommend?
1.35's community support ends at the end of 2027-03, after which it moves to platform support with the 60-day grace period. The officially planned platform-initiated upgrade month is 2027-06. At that point upgrades ignore maintenance windows, skip the deprecated API check and can override PDBs, right in the middle of peak season. Recommendations: ① rehearse 1.35 → 1.36 in staging now, and upgrade at a suitable time before peak season; ② or enroll in LTS (Premium tier, 1.35 LTS until 2028-03) to postpone the upgrade until after peak season, but evaluate the Premium cost and add-on compatibility; ③ either way, set the stable/patch channel and a maintenance window to avoid drifting again.
Verified teaching videos
Official documentation
- Supported Kubernetes versions in AKS
- Long-term support for AKS versions
- Platform-initiated upgrades
- AKS release tracker
Video storyboard (about 80 seconds)
This course material cannot generate a video or MP3 directly. A storyboard and narration script are provided, and they can be passed to a video tool.
Visual: horizontal timeline; the 1.35 block slides in from “Preview” into the green “Community support” zone.
Narration: Each Kubernetes minor version gets about one year of community support in AKS, and the three newest minor versions are supported at any time.
Visual: the block moves into the yellow “Platform support” zone, and a 60-day countdown appears.
Narration: After community support ends, the version moves into platform support. You have a 60-day grace period to upgrade yourself.
Visual: the countdown reaches zero, a red “Platform-initiated upgrade” stamp comes down, and the maintenance window and PDB icons are crossed out.
Narration: Starting June 2027, clusters that are still not upgraded when the grace period ends will be upgraded by the platform. This ignores maintenance windows, and it can override PDBs.
Visual: a blue LTS track extends one year from the end of community support, next to a staircase: 1.35 → 1.36 → 1.37.
Narration: For a longer runway, you can enable LTS on the Premium tier. Otherwise, climb the staircase one step at a time; you cannot skip minor versions.
Module 2 · Control plane and node pool upgrades: surge, blue-green and rollback
- Upgrade step by step in the order “control plane → system pool → user pools,” and understand the conflict between
--control-plane-onlyand auto-upgrade channels. - Describe precisely each step of an AKS rolling upgrade: create surge node → cordon/drain old nodes (via the Eviction API, subject to PDBs) → soak → reimage → become the buffer node for the next batch → finally delete the extra surge nodes.
- Choose values for
maxSurge/maxUnavailable/drainTimeout/nodeSoakDuration/undrainableNodeBehavior, and calculate the required quota and subnet IPs. - Perform a blue-green node pool switch, use
az aks nodepool rollback, and state the rollback limits (7 days, one step back only, control plane cannot be rolled back).
kubectl drain (K8s Hour 2), and the version rules from module 1. Importance: ★★★★★What: three upgrade scopes
| Type | Scope | Command | Workload impact |
|---|---|---|---|
| Control plane only | API server, etcd, controller-manager, scheduler, etc. (hosted on the AKS side) | az aks upgrade --control-plane-only | Nodes and Pods do not change; the data plane keeps running. During the upgrade the API may briefly reset connections, so controllers and clients must be able to retry |
| Full cluster | Control plane + all node pools (pools are upgraded one after another) | az aks upgrade --kubernetes-version | Every node is drained and reimaged |
| Node pool only | Kubernetes version of the specified pool (also updates to the latest node image for that version) | az aks nodepool upgrade --kubernetes-version | Nodes in that pool are drained and reimaged |
How: the real steps of a rolling (surge) upgrade
- Add surge nodes: add buffer nodes (new version, new image) to the VMSS according to
maxSurge. This requires extra compute quota and subnet IPs. - Cordon + drain: mark as many old nodes as there are buffer nodes as unschedulable (
spec.unschedulable=true), then call the Eviction API (POST /api/v1/namespaces/{ns}/pods/{pod}/eviction) for each Pod on them, one by one. The API server checks the PDB: if allowed, the Pod is deleted (graceful termination); if not, it returns 429 Too Many Requests, and AKS retries untildrainTimeout(default 30 minutes, range 5 minutes to 24 hours). DaemonSet Pods are not evicted. - Soak (optional): after drain completes, wait
nodeSoakDuration(default 0, maximum 30 minutes), giving you time to watch monitoring. - Reimage: the old node is reimaged to the new version and rejoins the cluster, becoming the buffer node for the next batch. This is why the number of surge nodes stays constant.
- Repeat until all nodes are done.
- Remove surge nodes: delete the extra buffer nodes, restoring the original node count and zone balance.
You can watch these stages with kubectl get events --field-selector reason=Surge / Drain / Upgrade (event reason names come from the official documentation).
Key parameters
| Parameter (CLI) | Default | Notes and recommendations |
|---|---|---|
--max-surge | The docs say “default 1 extra node” and elsewhere “usually 10%”; use nodepool show as the source of truth | Integer or percentage (rounded up). Recommended for production: 33%. A larger value is faster but drains more nodes at once. For 1.35+ pools, if the full surge quota cannot be obtained, it automatically falls back to surge=1. The value is persisted and reused by later upgrades. |
--max-unavailable | 0 | Adds no nodes; cordons and drains n existing nodes at the same time (in-place upgrade). Suitable when quota or capacity is insufficient. Cannot be set on the system pool; when 0, maxSurge must be > 0. The fallback logic “surge first, then fall back to in-place” when both are > 0 is currently in Preview. |
--drain-timeout (minutes) | 30 | 5–1440. If Pods still remain after the timeout, the upgrade stops (any later PUT continues it); otherwise it is handled according to the undrainable node behavior. |
--node-soak-duration (minutes) | 0 | 0–30; recommended 0–5. |
--undrainable-node-behavior | Schedule | Schedule: delete blocked nodes and replace them with surge nodes. Cordon (recommended): keep the node and label it kubernetes.azure.com/upgrade-status=Quarantined; the upgrade continues. Use together with --max-blocked-nodes. |
--enable-force-upgrade --upgrade-override-until | Disable | Bypasses the deprecated API check and PDBs; set it in preference to undrainable node behavior. Last resort. |
Quota and IP calculation: 5 pools × 4 nodes each, maxSurge 50% → you need 10 extra VMs of quota. With Azure CNI (non-Overlay), subnet IP demand ≈ (node count + maxSurge) × (1 + maxPods); Overlay only consumes subnet IPs for nodes. A single VMSS scale set is limited to 1000 instances; exceeding this is rejected before the upgrade starts.
Blue-green node pools (Blue/Green)
Manual blue-green (available in any version): create a green pool with the same spec (new version) → cordon the entire blue pool → drain node by node (also subject to PDBs) → observe → delete the blue pool. The advantage is that you can validate the new pool before draining, and if something goes wrong you can uncordon blue and switch back immediately; the cost is double node capacity. Managed blue-green (--upgrade-strategy bluegreen, requires aks-preview) lets AKS orchestrate the same process. It is currently Preview and not recommended for production.
Rollback boundaries
- The control plane cannot be downgraded. That is why it is recommended to run control-plane-only first, verify API compatibility, and then upgrade the node pools.
- Node pool rollback (
az aks nodepool rollback, GA, CLI 2.88.0+): within 7 days after the upgrade completes, both the Kubernetes version and the node image return to the previously recorded version (N-1; you cannot roll back several steps in a row). You must first turn off the cluster auto-upgrade channel (to restore the image, you must also turn off the node OS channel). Rollback replaces nodes and is affected by PDBs. OS SKU changes cannot be rolled back, you cannot roll back to an unsupported version, and platform-initiated upgrades cannot be rolled back. - Node images cannot be manually downgraded to an arbitrary older version. Within 7 days, however, an image-only upgrade can be restored to the previous VHD via rollback.
When: choosing a method
| Scenario | Recommended |
|---|---|
| General stateless pools with sufficient quota | Rolling surge, maxSurge 33%, PDB allows ≥1 disruption |
| GPU / scarce SKU, no extra capacity available | maxSurge 0 + maxUnavailable 1 (in-place) |
| Critical pool that must be switchable back instantly | Manual blue-green node pools |
| Stateful workloads (LRS disks bound to a zone) | Set surge to a multiple of 3 to keep zones balanced; or blue-green + zonal pools; PDB + sufficient drain timeout |
| Control plane version far behind | New cluster + traffic switchover (blue-green cluster), see Blue-green deployment of AKS clusters |
minAvailable: 100% (or maxUnavailable: 0) is the safest.” — It makes drain fail forever and leaves the upgrade stuck halfway; AKS's pre-upgrade validation treats such PDBs as a configuration error. ② “The larger maxSurge is, the safer.” — A larger surge means more old nodes drained at the same time. ③ “If an upgrade fails, you can roll back the control plane.” — No. ④ “maxUnavailable can also be set on the system pool.” — It cannot be set.Architecture diagram: components involved in a node pool upgrade
Flowchart: upgrade order for a 3-node pool with maxSurge=1
Core animation: node pool surge upgrade (cordon → drain subject to PDB → reimage → uncordon)
The apppool has 3 nodes on 1.35, with myapp at 4 replicas and redis at 1 replica. After choosing parameters, play it step by step: the terminal below each step shows the API that AKS is actually calling, or the events / kubectl output you would see.
az aks nodepool upgrade.Core commands
| Command | Purpose | Key parameters |
|---|---|---|
az aks upgrade --control-plane-only | Upgrade the control plane only | --kubernetes-version; not available when an auto-upgrade channel is enabled |
az aks nodepool upgrade | Upgrade a single node pool | --kubernetes-version, --max-surge, --max-unavailable, --node-soak-duration, --no-wait |
az aks nodepool update | Change the pool's persistent upgrade settings | --max-surge, --max-unavailable, --drain-timeout, --node-soak-duration, --undrainable-node-behavior, --max-blocked-nodes |
az aks nodepool get-rollback-versions / rollback | View / perform node pool rollback | Within 7 days, to the previous recorded version |
az aks nodepool operation-abort | Abort an in-progress node pool operation | The pool enters the Canceled state; the operation can be started again afterward |
kubectl get events --field-selector reason=Drain | Observe upgrade stages | Also reason=Surge, reason=Upgrade |
1) Upgrade the control plane only
az aks upgrade -g $RG -n $OPS --kubernetes-version 1.36.5 --control-plane-only --yes
az aks show -g $RG -n $OPS --query "{cp:currentKubernetesVersion,state:provisioningState}" -o table
az aks nodepool list -g $RG --cluster-name $OPS --query "[].{name:name,ver:currentOrchestratorVersion}" -o table
Cp State ------ --------- 1.36.5 Succeeded Name Ver ---------- ------ systempool 1.35.9 apppool 1.35.9
How to verify: the kubectl version Server Version shows v1.36.5, while node kubelet is still v1.35.9 (a skew of 1, which is allowed). Common error: with an auto-upgrade channel enabled, you get NotAllAgentPoolOrchestratorVersionSpecifiedAndUnchanged.
2) Set the pool's upgrade parameters, then upgrade
az aks nodepool update -g $RG --cluster-name $OPS -n apppool \ --max-surge 1 --drain-timeout 15 --node-soak-duration 2 \ --undrainable-node-behavior Cordon --max-blocked-nodes 1 az aks nodepool upgrade -g $RG --cluster-name $OPS -n apppool --kubernetes-version 1.36.5 --no-wait # Observe (in a separate terminal) kubectl get nodes -L agentpool,kubernetes.azure.com/upgrade-status -w kubectl get events -A --field-selector reason=Drain -w kubectl get events -A --field-selector reason=Surge
NAME STATUS ROLES AGE VERSION aks-apppool-12345678-vmss000003 Ready <none> 70s v1.36.5 aks-apppool-12345678-vmss000000 Ready,SchedulingDisabled <none> 3h v1.35.9 ... default 9m22s Normal Surge node/aks-apppool-12345678-vmss000003 Created a surge node [aks-apppool-12345678-vmss000003 apppool] for agentpool apppool default 2m1s Normal Drain node/aks-apppool-12345678-vmss000000 Draining node: [aks-apppool-12345678-vmss000000] default 1m45s Normal Upgrade node/aks-apppool-12345678-vmss000000 Soak duration 2m0s after draining node: aks-apppool-12345678-vmss000000
Production use: make --undrainable-node-behavior Cordon the default, so one bad PDB does not waste an entire maintenance window; pair it with an alert that monitors the upgrade-status=Quarantined label.
3) In-place upgrade (no added nodes, when quota is insufficient)
az aks nodepool upgrade -g $RG --cluster-name $OPS -n apppool \ --kubernetes-version 1.36.5 --max-surge 0 --max-unavailable 1
4) Manual blue-green node pools
# green: new version, same spec az aks nodepool add -g $RG --cluster-name $OPS -n appgreen --mode User \ --node-count 3 --node-vm-size Standard_D4s_v5 --kubernetes-version 1.36.5 # freeze blue, then drain node by node (subject to PDBs) kubectl cordon -l agentpool=apppool for n in $(kubectl get nodes -l agentpool=apppool -o name); do kubectl drain $n --ignore-daemonsets --delete-emptydir-data --timeout=10m done # Switch-back plan: kubectl uncordon -l agentpool=apppool ; delete blue after confirming everything is correct az aks nodepool delete -g $RG --cluster-name $OPS -n apppool --no-wait
Note: this hour's myapp uses nodeSelector: kubernetes.azure.com/mode=user, so the green pool (also in User mode) can receive Pods directly. If your workloads select nodes by agentpool=apppool, change the selector first.
5) Node pool rollback
az aks show -g $RG -n $OPS --query autoUpgradeProfile # first confirm the channel is turned off
az aks nodepool get-rollback-versions -g $RG --cluster-name $OPS -n apppool
az aks nodepool rollback -g $RG --cluster-name $OPS -n apppool
az aks nodepool show -g $RG --cluster-name $OPS -n apppool \
--query '{state:provisioningState,k8s:currentOrchestratorVersion,image:nodeImageVersion}'
{
"image": "AKSUbuntu-2204gen2containerd-202610.20.0",
"k8s": "1.35.9",
"state": "Succeeded"
}
After the rollback, the control plane is still 1.36.5 and the node pool is 1.35.9 (a skew of 1, which is legal). The node image name in the example is only an illustrative format.
Lab 2: step-by-step 1.35 → 1.36 upgrade and disruption measurement (about 30–45 min, mostly waiting)
Goal: upgrade the control plane first, then systempool and apppool; measure disruption with the prober; and observe the impact of Redis's single replica. Cost: one extra surge VM during the upgrade. Permissions: Contributor (or AKS Contributor). Risk: Redis has no replica, so draining its node causes a brief outage. This is the phenomenon this lab is meant to observe.
kubectl get pod -n myapp -o wide kubectl get pdb -n myapp kubectl logs -n myapp prober --tail=3
time az aks upgrade -g $RG -n $OPS --kubernetes-version 1.36.5 --control-plane-only --yes kubectl version | grep Server
Expected: Server Version v1.36.5; the prober shows no non-200 responses (even if API connections reset, the data plane is unaffected).
az aks nodepool update -g $RG --cluster-name $OPS -n systempool --max-surge 33% az aks nodepool upgrade -g $RG --cluster-name $OPS -n systempool --kubernetes-version 1.36.5 --yes
Note: the prober is a standalone Pod not managed by any controller, so it will not be recreated when its node is drained (AKS's exact handling of standalone Pods follows actual behavior). If kubectl get pod -n myapp prober shows nothing after the upgrade, recreate it with the module 0 command. In production, run the prober as a Deployment.
az aks nodepool update -g $RG --cluster-name $OPS -n apppool --max-surge 1 --drain-timeout 15 --node-soak-duration 2 --undrainable-node-behavior Cordon az aks nodepool upgrade -g $RG --cluster-name $OPS -n apppool --kubernetes-version 1.36.5 --no-wait watch -n5 'kubectl get nodes -L agentpool; kubectl get pod -n myapp -o wide; kubectl get pdb -n myapp'
myapp-pdb N/A 1 0 ← ALLOWED DISRUPTIONS briefly 0 during drain (1 Pod is being rebuilt) prober: 10:21:07 000 10:21:08 000 ... 10:21:19 200 ← about 10 seconds of 5xx/timeouts while Redis is evicted
az aks nodepool list -g $RG --cluster-name $OPS --query "[].{n:name,v:currentOrchestratorVersion,img:nodeImageVersion}" -o table
kubectl get nodes -o custom-columns=NAME:.metadata.name,VER:.status.nodeInfo.kubeletVersionAll nodes on v1.36.5; apppool still has 3 nodes (surge node deleted).
az aks nodepool rollback -g $RG --cluster-name $OPS -n apppool, confirm it returns to 1.35.9, then upgrade to 1.36.5 again.Cleanup: none (the cluster continues to be used in later modules). Think about it: how would you eliminate the Redis disruption? Run Redis with primary/replica and Sentinel, or switch to Azure Managed Redis, and configure a PDB for it.
Case 1: a PDB stalled an upgrade for 30 minutes
Problem: a service has 2 replicas and PDB minAvailable: 2. The overnight auto-upgrade failed after the first node's drain timed out, leaving the cluster in provisioningState=Failed. Approach: change to maxUnavailable: 1 and scale to 3 replicas; set the pool to --undrainable-node-behavior Cordon --max-blocked-nodes 1; alert on the Quarantined label. Limitation: after Cordon, quarantined nodes must be handled manually (delete the PDB or label, or delete-machines, then run az aks update to reconcile the state).
Case 2: a GPU pool cannot get surge capacity
Problem: AllocationFailed / SKUNotAvailable; surge nodes cannot be created. Approach: upgrade the GPU pool in place with --max-surge 0 --max-unavailable 1; pause training jobs or checkpoint them before the maintenance window. Limitation: pool capacity drops during an in-place upgrade, and Pending Pods wait.
Case 3: blue-green switchover for a payments core pool
Problem: the team must be able to switch back within 1 minute if something goes wrong. Approach: for each minor upgrade, create a green pool; canary-style, first drain one blue node and observe it for 30 minutes, then migrate everything; keep the blue pool for 24 hours before deleting it. Limitations: the cost and quota of double capacity; changing the node pool name affects selectors based on the agentpool label and Azure Policy.
Common errors and fixes
Code: UpgradeFailed Message: Drain node ... failed when evicting pod ... Cannot evict pod as it would violate the pod's disruption budget.
Cause: the PDB allows no disruption (replicas ≤ minAvailable, or Pods that are not Ready leave currentHealthy too low), so drain keeps receiving 429 until drainTimeout.
kubectl get pdb -A -o custom-columns=NS:.metadata.namespace,NAME:.metadata.name,ALLOWED:.status.disruptionsAllowed,HEALTHY:.status.currentHealthy,DESIRED:.status.desiredHealthy kubectl get nodes -l kubernetes.azure.com/upgrade-status=Quarantined
Fix: correct the PDB (maxUnavailable: 1) or add replicas, then rerun the upgrade (any PUT will continue it). Prevention: --undrainable-node-behavior Cordon.
NotAllAgentPoolOrchestratorVersionSpecifiedAndUnchanged: Using managed cluster api, all Agent pools' OrchestratorVersion must be all specified or all unspecified...
Cause: --control-plane-only was run while the cluster had an auto-upgrade channel enabled.
az aks show -g $RG -n $OPS --query autoUpgradeProfile.upgradeChannel
Fix: temporarily set the channel to none and upgrade step by step, or accept a full cluster upgrade.
SubnetIsFull / AllocationFailed / QuotaExceeded during upgrade surge
Cause: surge nodes need extra IP and vCPU quota.
az vm list-usage -l $LOC -o table | grep -i "Standard DSv5"
az network vnet subnet show -g $RG --vnet-name vnet-aks-lab -n snet-nodes --query "{prefix:addressPrefix, used:length(ipConfigurations)}"
Fix: lower maxSurge or switch to maxUnavailable; request more quota; enlarge the subnet or switch to Azure CNI Overlay (the node subnet only consumes node IPs). See Hour 7.
Rollback: get-rollback-versions returns empty / AKS rejects the previous Kubernetes version
Cause: more than 7 days have passed, there is no upgrade record, the previous version is no longer supported, or the OS SKU has been changed.
Fix: if rollback is not possible, the only option is to roll forward: fix the application, replace the node pool (blue-green), or create a new pool with --kubernetes-version set to a still-supported older version (it must be ≤ the control plane and within the skew range).
Cluster provisioningState: Failed; every later operation fails
Cause: the upgrade failed midway (drain timeout, quota, etc.), leaving the cluster in a failed state.
az aks show -g $RG -n $OPS --query "{state:provisioningState,power:powerState.code}"
az monitor activity-log list -g $RG --offset 6h --query "[?contains(operationName.value,'managedClusters')].{op:operationName.value,status:status.value,msg:properties.statusMessage}" -o table
Fix: after fixing the root cause, run az aks update -g $RG -n $OPS once with no extra parameters (to reconcile the state), or start the upgrade again.
1. Configure apppool with: surge 33%, drain timeout 20 minutes, soak 3 minutes, quarantine for undrainable nodes, and a maximum of 2 blocked nodes.
az aks nodepool update -g $RG --cluster-name $OPS -n apppool --max-surge 33% --drain-timeout 20 --node-soak-duration 3 --undrainable-node-behavior Cordon --max-blocked-nodes 2
2. List all nodes quarantined by an upgrade (Quarantined), and remove that label after fixing the PDB.
kubectl get nodes -l kubernetes.azure.com/upgrade-status=Quarantined kubectl label nodes NODE kubernetes.azure.com/upgrade-status-
A 12-node user pool uses Azure CNI (non-Overlay), maxPods=30, and the subnet has 300 IPs left. The team wants to set maxSurge to 50% to shorten the window. Is this feasible?
maxSurge 50% → 6 surge nodes. Each node uses 1 + maxPods = 31 IPs, so 6 × 31 = 186 IPs, and the remaining 300 is enough. You must also confirm the vCPU quota for the 6 extra VMs. Another risk is draining 6 nodes at once, so your PDBs and remaining capacity must be able to absorb that. For production, 33% (4 nodes) is recommended. If the subnet is tight, moving to Overlay networking fixes the root cause.
Verified teaching videos
Official documentation
- Upgrade the AKS cluster control plane
- Configure rolling upgrades for node pools
- Upgrade options and recommendations
- Roll back node pool versions
- Kubernetes: API-initiated eviction
Video storyboard (about 100 seconds)
This lesson cannot directly generate a video or MP3, so a storyboard and narration script are provided instead.
Visual: three grey nodes. A fourth blue “surge” node pops out of the VMSS.
Narration: When the upgrade starts, AKS first creates one buffer node on the new version based on max surge, so capacity does not drop.
Visual: the first old node turns yellow and is cordoned. Pods fly toward the API server one by one. At the PDB shield, a green light lets them through, and a red light returns 429.
Narration: Next, the old node is marked unschedulable, and pods are evicted one at a time through the eviction API. Every eviction is checked against the PDB. If it is not allowed, the API returns 429, and AKS keeps retrying until the timeout.
Visual: the empty node flashes red with “reimage,” turns green, and shows 1.36. Then it becomes the buffer for the next node.
Narration: Once the node is empty, it goes through an optional soak period, is reimaged to the new version, and then becomes the buffer node for the next batch.
Visual: everything turns green, and the extra nodes fade out. A “7-day rollback” clock and a “control plane cannot be downgraded” badge appear in the bottom-right corner.
Narration: After everything is done, the extra buffer nodes are deleted. A node pool can be rolled back one step within seven days, but the control plane cannot be downgraded.
Module 3 · Node image upgrades, auto-upgrade channels and maintenance windows
- Distinguish Kubernetes version upgrades from node image upgrades. Linux node images are released weekly, and Windows images monthly. A node image upgrade does not change the Kubernetes version.
- Explain the meaning of the cluster auto-upgrade channels
none / patch / stable / rapid / node-image (legacy), and the differences among the node OS channelsNone / Unmanaged / SecurityPatch / NodeImage. - Use
az aks maintenanceconfiguration addto createdefault,aksManagedAutoUpgradeSchedule, andaksManagedNodeOSUpgradeSchedule. Know the rules for a duration of at least 4 hours, a lead time of 15 minutes,notAllowedDates, and so on. - Know the boundaries of a window. Maintenance is best effort. Emergency fixes and platform-initiated upgrades can ignore the window. An operation that starts inside the window can finish after it ends.
What: node images (VHD)
AKS nodes boot from VHDs built by AKS (for example AKSUbuntu-2404gen2containerd-YYYYMM.DD.x, Azure Linux 3, or Windows Server 2025). The image includes OS patches, containerd, kubelet, and so on. New images are released weekly for Linux and monthly for Windows. With safe deployment practices, all regions are covered in about two weeks. Track progress in the AKS release tracker. Running nodes do not switch images on their own. You must use a node image upgrade (reimage) or a node OS channel.
- Manual:
az aks nodepool upgrade --node-image-only(one pool) oraz aks upgrade --node-image-only(all pools). - Any Kubernetes upgrade also moves node images to the latest version.
- Node images cannot be downgraded manually. Within 7 days, a node pool rollback can restore the previous VHD.
- Clusters with NAP enabled get their images updated by NAP's drift logic (see hour 4).
- Watch for retirement: Azure Linux 2.0 images are removed starting 2026-10-31. Node pools still using them cannot scale out, so migrate them to
AzureLinux3.
Cluster auto-upgrade channels (Kubernetes version)
| Channel | Behavior (examples use 1.35.7; available versions are 1.35.9 / 1.36.4 / 1.36.5 / 1.37.1) | Best for |
|---|---|---|
none | No automatic upgrades (default for Standard clusters) | Fully controlled by pipelines or people |
patch | Upgrades to the latest patch of the same minor version → 1.35.9 | You want patches quickly while controlling minor upgrades yourself; recommended for LTS clusters |
stable | Upgrades to the latest patch of N-1 → 1.36.5 | Most production clusters; AKS Automatic always uses this |
rapid | Upgrades to the latest patch of the newest minor version. If you are on N-2, upgrade to the latest patch of N-1 first → 1.36.5 → 1.37.1 | dev / early validation environments |
node-image (legacy) | Only auto-upgrades node images; planned for deprecation | Switch to the node OS channel NodeImage |
Key points: auto-upgrade only moves to GA versions. Upgrade the control plane first, then upgrade node pools one at a time. Channel changes can take up to 24 hours to take effect. The cluster must be within its support window; after it expires, auto-upgrade no longer applies and the platform-initiated upgrade takes over. Once enabled, control-plane-only upgrades are no longer possible.
Node OS auto-upgrade channels (these do not change the Kubernetes version)
| Channel | Who is responsible | Cadence | Details |
|---|---|---|---|
None | You | — | No security updates are applied automatically |
Unmanaged | Built-in OS mechanism | Ubuntu/Azure Linux, around 06:00 UTC daily | unattended-upgrades / dnf-automatic; new machines start unpatched; needs a tool such as kured to handle reboots; on Windows, equivalent to None |
SecurityPatch | AKS (tested, safe deployment) | Usually faster than weekly | Security patches only. Reimages only when necessary; otherwise patches online without draining. VHDs are stored in the node resource group, which adds cost. Windows is not supported. Requires access to snapshot.ubuntu.com. Conflicts with deny policies that require CMK (it temporarily creates a VMSS with a copy- prefix). |
NodeImage | AKS | Weekly | Replaces the VHD (including security and bug fixes), and follows the maintenance window and surge settings. No extra VHD cost. Default for new Standard clusters since API 2023-06-01. AKS Automatic always uses this. |
When you choose NodeImage, SecurityPatch, or the cluster channel node-image, unattended upgrades on Linux are disabled by default. When the cluster channel is node-image, the node OS channel is locked to NodeImage and cannot be changed. Switching from another channel to Unmanaged (or from Unmanaged to None) triggers a reimage.
Maintenance configurations (Planned Maintenance)
| Name | What it controls | Supported cadence |
|---|---|---|
default | Control plane components and system add-ons (CoreDNS, metrics-server, and so on) in the AKS weekly release | Weekly only |
aksManagedAutoUpgradeSchedule | Run time for the cluster auto-upgrade channel | Daily / Weekly / AbsoluteMonthly / RelativeMonthly |
aksManagedNodeOSUpgradeSchedule | Run time for the node OS channel | Daily / Weekly / AbsoluteMonthly / RelativeMonthly |
- Window duration at least 4 hours. After you create or change a configuration, leave at least 15 minutes before the window starts.
- Properties:
startDate,startTime,utcOffset(default +00:00),durationHours,schedule,notAllowedDates(config file method only). - Best effort: operations that start inside the window can finish after it ends, but no new upgrade operation starts after the window closes. Within the same window, if a newer image appears, a node may be upgraded twice.
- Urgent, critical reactive maintenance can break the window (even notAllowedDates). Platform-initiated upgrades do not follow the window.
- The cluster must be running when the window starts. A stopped cluster cannot perform any operations.
- Do not share one window across all clusters in a subscription (this causes ARM throttling). Shared maintenance window resources (
az aks maintenancewindow) are currently in Preview. - Maintenance windows have nothing to do with Azure platform maintenance of the underlying VMSS hosts.
When: recommended combinations
| Environment | Cluster channel | Node OS channels | Window |
|---|---|---|---|
| dev | rapid | NodeImage | Weekday daytime, weekly |
| staging | stable | NodeImage | 1 week earlier than prod |
| prod | stable (or patch, with pipeline-controlled minor upgrades) | NodeImage (use SecurityPatch for faster security fixes) | Cluster: first Sunday of each month, 4–6 hours. Node OS: every Sunday. |
| LTS prod | patch | NodeImage / SecurityPatch | Same as above |
Architecture diagram: two channels + three maintenance configurations
Node OS channel comparison: NodeImage vs SecurityPatch
Simulator: over one month, what do the channels and window do to the cluster?
Pick two channels and a window, then press play. Each “day” may include an AKS release event (new VHD, new patch, new minor version). The simulator checks whether the channel cares about the event and whether that day is inside the window, then prints the matching real operation in the terminal.
Core commands
| Command | Purpose | Key parameters |
|---|---|---|
az aks nodepool get-upgrades | Show the latest node image available to the pool | Output field latestNodeImageVersion |
az aks nodepool upgrade --node-image-only | Upgrade node images for a single pool | Uses the pool's surge, drain, and soak settings |
az aks upgrade --node-image-only | Upgrade node images for all pools | --yes |
az aks update --auto-upgrade-channel | Set the cluster channel | none|patch|stable|rapid|node-image |
az aks update --node-os-upgrade-channel | Set the node OS channel | None|Unmanaged|SecurityPatch|NodeImage (SecurityPatch requires CLI 2.61+) |
az aks maintenanceconfiguration add|update|list|show|delete | Maintenance window | --name, --schedule-type, --day-of-week, --interval-weeks, --duration, --utc-offset, --start-time, --config-file |
1) Manual node image upgrade
az aks nodepool get-upgrades -g $RG --cluster-name $OPS --nodepool-name apppool --query latestNodeImageVersion -o tsv
az aks nodepool show -g $RG --cluster-name $OPS -n apppool --query nodeImageVersion -o tsv
az aks nodepool upgrade -g $RG --cluster-name $OPS -n apppool --node-image-only --no-wait
kubectl get nodes -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.metadata.labels.kubernetes\.azure\.com\/node-image-version}{"\n"}{end}'
AKSUbuntu-2204gen2containerd-202611.03.0 AKSUbuntu-2204gen2containerd-202610.20.0 aks-apppool-12345678-vmss000000 AKSUbuntu-2204gen2containerd-202611.03.0 aks-systempool-87654321-vmss000000 AKSUbuntu-2204gen2containerd-202610.20.0
2) Set both channels
az aks update -g $RG -n $OPS --auto-upgrade-channel stable --node-os-upgrade-channel NodeImage az aks show -g $RG -n $OPS --query autoUpgradeProfile
{
"nodeOsUpgradeChannel": "NodeImage",
"upgradeChannel": "stable"
}
3) Create maintenance configurations (CLI parameters)
# Node OS: every Sunday 02:00–06:00 (UTC-05:00, Toronto winter time) az aks maintenanceconfiguration add -g $RG --cluster-name $OPS \ --name aksManagedNodeOSUpgradeSchedule \ --schedule-type Weekly --day-of-week Sunday --interval-weeks 1 \ --duration 4 --utc-offset -05:00 --start-time 02:00 # Cluster version: first Sunday of each month, 02:00–08:00 az aks maintenanceconfiguration add -g $RG --cluster-name $OPS \ --name aksManagedAutoUpgradeSchedule \ --schedule-type RelativeMonthly --day-of-week Sunday --week-index First --interval-months 1 \ --duration 6 --utc-offset -05:00 --start-time 02:00 az aks maintenanceconfiguration list -g $RG --cluster-name $OPS -o table
--week-index (First/Second/Third/Fourth/Last) and --interval-months are used for RelativeMonthly. AbsoluteMonthly uses --day-of-month. Daily uses --interval-days (aksManaged* configurations only). --start-date sets the effective date. Parameters were checked against the CLI reference (az aks maintenanceconfiguration, 2026-09).
4) Config file method (supports notAllowedDates, for example a year-end freeze)
{
"properties": {
"maintenanceWindow": {
"schedule": { "relativeMonthly": { "intervalMonths": 1, "dayOfWeek": "Sunday", "weekIndex": "First" } },
"durationHours": 6,
"utcOffset": "-05:00",
"startTime": "02:00",
"notAllowedDates": [ { "start": "2026-12-20", "end": "2027-01-04" } ]
}
}
}
az aks maintenanceconfiguration update -g $RG --cluster-name $OPS \ --name aksManagedAutoUpgradeSchedule --config-file ./aksManagedAutoUpgradeSchedule.json
Common mistakes: a window shorter than 4 hours stops auto-upgrade from finishing. Setting the window to “5 minutes from now” means it will not take effect this time (it needs at least 15 minutes of lead time). Putting all clusters in the same window causes ARM throttling. Production use: manage these through Terraform (maintenanceConfigurations in azapi_resource) or Bicep. See hour 5.
Lab 3: Configure “stable + NodeImage + two windows” for aks-lab-ops (about 10 minutes)
Goal: turn on the auto-upgrade you disabled in Module 0, using production policy, and verify it. Cost: no extra cost (later auto-upgrades will incur surge node costs). Risk: if your window falls within the next few hours, the cluster may actually start upgrading. During the lab, set the window to next week.
az aks nodepool upgrade -g $RG --cluster-name $OPS -n apppool --node-image-only --yes kubectl get events -A --field-selector reason=Drain | tail -3
az aks update -g $RG -n $OPS --auto-upgrade-channel stable --node-os-upgrade-channel NodeImage
maintenanceconfiguration add commands on the “Commands” tab above)az aks show -g $RG -n $OPS --query autoUpgradeProfile -o json az aks maintenanceconfiguration show -g $RG --cluster-name $OPS --name aksManagedAutoUpgradeSchedule --query maintenanceWindow
{
"durationHours": 6,
"schedule": { "relativeMonthly": { "dayOfWeek": "Sunday", "intervalMonths": 1, "weekIndex": "First" }, "weekly": null, ... },
"startTime": "02:00",
"utcOffset": "-05:00"
}az aks upgrade -g $RG -n $OPS --kubernetes-version 1.37.1 --control-plane-only --yes
Expected error: NotAllAgentPoolOrchestratorVersionSpecifiedAndUnchanged (or a version-not-available error if 1.37 is not yet available for this cluster).
Cleanup/rollback: if you do not want auto-upgrades during the course, run az aks update -g $RG -n $OPS --auto-upgrade-channel none --node-os-upgrade-channel None. You can keep the window configurations.
Case 1: Monday morning, and you find all nodes were rebuilt
Problem: no node OS window was configured, so the NodeImage channel reimaged nodes during weekday daytime. Fix: create aksManagedNodeOSUpgradeSchedule (every Sunday, 4 hours). Monitor the upgrade events in Event Grid and push them to Teams. Limitation: the window is best effort and should not be treated as a guarantee.
Case 2: CVE emergency, and you can't wait for the weekly image
Problem: a high-severity kernel vulnerability was disclosed. Fix: switch the Linux pool to SecurityPatch. Most patches apply online. Kernel patches that need a reboot are reimaged within the window. Confirm the patch date through the suffix of the kubernetes.azure.com/node-image-version label. Limitations: SecurityPatch is not supported on Windows pools. If the organization has a deny policy requiring CMK for the OS disk, you get RequestDisallowedByPolicy and must use NodeImage.
Case 3: year-end business freeze
Problem: changes are prohibited from December 20 to January 4. Fix: add notAllowedDates to both maintenance configurations. Finish the upgrades by hand one week before the freeze, so the freeze period does not end up needing a platform-initiated upgrade. Limitation: urgent reactive maintenance can still happen.
Common errors and fixes
A maintenance window is configured, but auto-upgrade never happens
Cause: the window is shorter than 4 hours; the configuration was created or changed less than 15 minutes before the start; the channel is none; the cluster was Stopped when the window started; the cluster is no longer supported (auto-upgrade no longer applies); or there is no upgrade target.
az aks show -g $RG -n $OPS --query "{auto:autoUpgradeProfile,power:powerState.code,ver:currentKubernetesVersion}"
az aks maintenanceconfiguration list -g $RG --cluster-name $OPS -o table
az aks get-upgrades -g $RG -n $OPS -o tableWhy was one of my agent pools upgraded outside the maintenance window?
Cause: operations that started before the window ended continue until they finish, or it is a platform-initiated upgrade or emergency maintenance.
az monitor activity-log list -g $RG --offset 3d --query "[?contains(operationName.value,'agentPools')].{time:eventTimestamp,op:operationName.value,caller:caller}" -o table
Fix: move the window start earlier and extend the duration. For large pools, increase maxSurge to shorten each operation.
RequestDisallowedByPolicy during SecurityPatch upgrade (copy-… VMSS)
Cause: SecurityPatch temporarily creates a VMSS with a copy- prefix, which is rejected by a deny policy requiring CMK encryption of the OS disk.
Fix: add a policy exemption to the node resource group, or switch to the NodeImage channel.
Cannot change nodeOsUpgradeChannel: cluster autoupgrade channel is node-image
Cause: when the cluster channel is the legacy node-image, the node OS channel is locked to NodeImage.
az aks update -g $RG -n $OPS --auto-upgrade-channel stable --node-os-upgrade-channel SecurityPatch
1. Create a node OS maintenance window that starts every two weeks on Saturday at 23:00, lasts 5 hours, and uses UTC-05:00.
az aks maintenanceconfiguration add -g $RG --cluster-name $OPS --name aksManagedNodeOSUpgradeSchedule --schedule-type Weekly --day-of-week Saturday --interval-weeks 2 --duration 5 --utc-offset -05:00 --start-time 23:00
2. Use one command to output the current and latest available node image for each pool.
for p in $(az aks nodepool list -g $RG --cluster-name $OPS --query "[].name" -o tsv); do echo "$p $(az aks nodepool show -g $RG --cluster-name $OPS -n $p --query nodeImageVersion -o tsv) -> $(az aks nodepool get-upgrades -g $RG --cluster-name $OPS --nodepool-name $p --query latestNodeImageVersion -o tsv)"; done
The security team requires all nodes to get high-severity patches within 7 days. The platform team requires no reimages on weekdays. The cluster has a Windows pool. How would you design this?
Linux pool: node OS channel SecurityPatch (most patches apply online, with reimage when necessary) + an aksManagedNodeOSUpgradeSchedule weekend window to meet the 7-day target. Windows pools do not support SecurityPatch, and the node OS channel is a cluster-level setting, so you can choose NodeImage for them. Windows images are released monthly, so if you cannot meet 7 days, run --node-image-only manually for urgent CVEs. Note that the channel is per cluster. If different pools must follow different policies, consider splitting the cluster or orchestrating the upgrades manually in the pipeline. Audit each run with Event Grid or the activity log.
Verified teaching videos
Official documentation
- Upgrade node images
- Automatically upgrade an AKS cluster
- Autoupgrade node OS images
- Use Planned Maintenance
Video storyboard (about 90 seconds)
This lesson cannot directly generate a video or MP3, so a storyboard and narration script are provided instead.
Visual: two conveyor belts. The top one says “Kubernetes version,” and the bottom one says “node image.” Each has a gear labeled “channel.”
Narration: AKS has two separate auto-upgrade channels. One upgrades the Kubernetes version, and the other updates the node operating system image.
Visual: the top gear is set to patch, stable, and rapid. Arrows point to different version numbers.
Narration: patch upgrades only patch versions. stable moves to the second-newest minor version. rapid tracks the latest version.
Visual: the bottom gear is set to NodeImage (a new disk every week) and SecurityPatch (shield, online patching).
Narration: NodeImage replaces the image every week. SecurityPatch delivers security patches faster, and in most cases you do not need to rebuild the nodes.
Visual: two colored time blocks on a calendar. A red arrow labeled “urgent maintenance / platform-initiated upgrade” goes around the calendar.
Narration: Maintenance configurations decide when work runs, and a window lasts at least four hours. Urgent maintenance and platform-initiated upgrades can ignore the window.
Module 4 · Observability: Container Insights and Managed Prometheus
- Draw the two data pipelines: ama-metrics (Prometheus scraping → Azure Monitor workspace → Grafana and PromQL alerts) and ama-logs (stdout/stderr, Kubernetes manifests, performance → DCR → Log Analytics).
- Use the CLI to enable Managed Prometheus (
--enable-azure-monitor-metrics, with optional control plane metrics) and Container Insights (az aks enable-addons --addon monitoring), and verify the agents. - Control log costs with the cost presets (Logs and Events / Standard / Cost-optimized / Syslog) and
dataCollectionSettings. - For the details, study Prometheus & Grafana hour 3: scrape configs, recording rules, alerting rules, and Grafana.
What: the Kubernetes monitoring components in Azure Monitor
| Component | What it collects | Storage | In-cluster agent |
|---|---|---|---|
| Managed Prometheus (Azure Monitor managed service for Prometheus) | Prometheus metrics: kubelet/cAdvisor, kube-state-metrics, node-exporter, and the application metrics you configure. Optional API server and etcd control plane metrics. | Azure Monitor workspace (if not specified, the default workspace in the resource group is used or created) | ama-metrics (ReplicaSet), ama-metrics-ksm, ama-metrics-node (DaemonSet); on Windows, ama-metrics-win-node |
| Container Insights (container logs and inventory) | Container stdout/stderr, Kubernetes events, Pod and node inventory, performance data, optional Syslog | Log Analytics workspace: ContainerLogV2, KubeEvents, KubePodInventory, Perf, InsightsMetrics… | ama-logs (DaemonSet), ama-logs-rs (Deployment), ama-logs-windows |
| Azure Managed Grafana (or Grafana dashboards in the Azure portal) | Visualization | — | None (linked to the Azure Monitor workspace) |
| Resource logs (diagnostic settings) | Control plane logs (Module 5) | Log Analytics / storage account / Event Hubs | None (emitted from the AKS side) |
Both agents are driven by data collection rules (DCR). The DCR is associated with the cluster (DCRA), and the agents read it to decide what to collect and where to send it. So changing collection settings usually means editing the DCR or a ConfigMap (such as ama-metrics-settings-configmap), not the DaemonSet.
Why: why not self-host Prometheus + Loki
- Managed storage: no need to maintain Prometheus persistent volumes, high availability, or long-term storage. PromQL and Grafana are compatible.
- Azure integration: Entra authentication, Azure Monitor alerts, and Defender and Copilot diagnostics all use the same data.
- Trade-offs: billing is based on ingestion (samples / GB), and custom scraping must follow ConfigMap conventions. Some advanced uses, such as remote write to multiple backends, need extra configuration. For a detailed comparison, see Prometheus & Grafana hour 3.
How: log cost presets
| Preset | Frequency | Namespace filtering | Data collected |
|---|---|---|---|
| Logs and Events (default) | 1m | None | ContainerLogV2, KubeEvents, KubePodInventory (recommended when you already have Managed Prometheus) |
| Standard | 1m | None | All standard Container Insights tables (needed for the portal's default visualizations) |
| Cost-optimized | 5m | Exclude kube-system, gatekeeper-system, azure-arc | All standard tables |
| Syslog | 1m | None | All standard tables + Syslog |
Fields in dataCollectionSettings.json: interval (1m–30m), namespaceFilteringMode (Off/Include/Exclude), namespaces, enableContainerLogV2 (default true), streams. ContainerLogV2 supports the Basic logs table plan, which can cut costs significantly (with limited query capabilities).
When: the smallest production-ready combination
- Metrics: Managed Prometheus (+ control plane metrics) + recommended alert rules + Grafana.
- Logs: the Container Insights “Logs and Events” preset + ContainerLogV2 + Exclude for noisy namespaces.
- Control plane: diagnostic settings (Module 5).
- During upgrades, focus on: ready node count, Pod restarts,
kube_pod_status_ready, API server latency and 5xx responses, and PDBdisruptions_allowed(the kube-state-metrics metrickube_poddisruptionbudget_status_pod_disruptions_allowed).
Architecture diagram: two data pipelines
Upgrade observability: which signals to watch during an upgrade
Data flow animation: the journey of one metric sample and one log line
Choose “Metrics” or “Logs” and step through each hop from container to storage to query. The terminal shows the real object or query for each hop.
Core commands
| Command | Purpose | Key parameters |
|---|---|---|
az aks update --enable-azure-monitor-metrics | Enable Managed Prometheus | --azure-monitor-workspace-resource-id, --grafana-resource-id, --enable-control-plane-metrics, --ksm-metric-labels-allow-list |
az aks update --disable-azure-monitor-metrics | Disable Managed Prometheus | — |
az aks enable-addons --addon monitoring | Enable Container Insights | --workspace-resource-id, --data-collection-settings |
az aks disable-addons --addon monitoring | Disable | — |
kubectl get ds ama-logs ama-metrics-node -n kube-system | Verify agents | DESIRED should equal the number of Linux nodes |
1) Create a workspace and enable Managed Prometheus (including control plane metrics)
az monitor account create -g $RG -n amw-aks-lab -l $LOC # Azure Monitor workspace AMW_ID=$(az monitor account show -g $RG -n amw-aks-lab --query id -o tsv) az aks update -g $RG -n $OPS --enable-azure-monitor-metrics \ --azure-monitor-workspace-resource-id $AMW_ID --enable-control-plane-metrics kubectl get rs -n kube-system | grep ama-metrics kubectl get ds ama-metrics-node -n kube-system
ama-metrics-5c974985b8 1 1 1 3m ama-metrics-ksm-5fcf8dffcd 1 1 1 3m NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE AGE ama-metrics-node 5 5 5 5 5 3m
To also link Azure Managed Grafana, add --grafana-resource-id $GRAFANA_ID. This requires Owner, or Contributor plus User Access Administrator, on Grafana. For Grafana details and PromQL, see Prometheus & Grafana hour 3.
2) Create a Log Analytics workspace and enable Container Insights (custom collection)
{
"interval": "1m",
"namespaceFilteringMode": "Exclude",
"namespaces": ["kube-system", "gatekeeper-system"],
"enableContainerLogV2": true,
"streams": ["Microsoft-ContainerLogV2", "Microsoft-KubeEvents", "Microsoft-KubePodInventory"]
}
az monitor log-analytics workspace create -g $RG -n law-aks-lab -l $LOC LAW_ID=$(az monitor log-analytics workspace show -g $RG -n law-aks-lab --query id -o tsv) az aks enable-addons -g $RG -n $OPS --addon monitoring \ --workspace-resource-id $LAW_ID --data-collection-settings dataCollectionSettings.json kubectl get ds ama-logs -n kube-system kubectl get deployment ama-logs-rs -n kube-system
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE ama-logs 5 5 5 5 5 <none> 2m NAME READY UP-TO-DATE AVAILABLE AGE ama-logs-rs 1/1 1 1 2m
3) Verify data (after 10–15 minutes)
ContainerLogV2 | where TimeGenerated > ago(30m) | where PodNamespace == "myapp" | summarize lines = count() by PodName, LogLevel | order by lines desc
sum by (namespace) (kube_pod_status_ready{condition="true", namespace="myapp"})
kube_poddisruptionbudget_status_pod_disruptions_allowed{namespace="myapp"}
How to verify: in the portal, go to the cluster → Monitoring → Insights / Metrics, or run PromQL in the Prometheus explorer of the Azure Monitor workspace. Common error: agent Pods in CrashLoopBackOff, usually because outbound traffic is blocked by a firewall. Allow the Azure Monitor FQDNs. See the outbound rules in hour 2.
Lab 4: Enable both pipelines and observe during an upgrade (about 15 minutes, plus time for data to arrive)
Cost: the Azure Monitor workspace is billed by ingested samples, and Log Analytics by GB. This lab's data volume is small (usually < $1/day), but be sure to delete the workspace or turn off the add-ons during cleanup. Permissions: Contributor on the resource group. Linking Grafana requires extra role assignment permissions.
for i in $(seq 1 50); do kubectl exec -n myapp prober -- curl -s http://myapp.myapp/ >/dev/null; done kubectl rollout restart deploy/myapp -n myapp
KubeEvents
| where TimeGenerated > ago(1h)
| where Namespace == "myapp" or Reason in ("Drain","Surge","Upgrade")
| project TimeGenerated, Namespace, Name, Reason, Message
| order by TimeGenerated descaz aks nodepool upgrade -g $RG --cluster-name $OPS -n apppool --node-image-only --no-wait
sum(kube_node_spec_unschedulable)
min_over_time(kube_poddisruptionbudget_status_pod_disruptions_allowed{namespace="myapp"}[5m])Verify: you can see myapp's logs in Log Analytics, and in PromQL you can see the number of ready myapp Pods briefly drop to 3 during the drain. Cleanup: delete everything together after Module 8. To turn off only these features: az aks disable-addons -g $RG -n $OPS --addon monitoring and az aks update -g $RG -n $OPS --disable-azure-monitor-metrics.
Case 1: the Log Analytics bill grew 5x in one month
Problem: one team sent debug logs to stdout, and Container Insights collects everything by default. Fix: enable ContainerLogV2 and set the table to Basic logs; exclude by namespace; lower the log level for noisy workloads; set a daily cap alert on the workspace. Limitation: Basic logs have limited query and alerting capabilities. For retention and pricing, see the Azure Monitor docs.
Case 2: replace a self-managed kube-prometheus-stack with Managed Prometheus
Problem: the PVs for the self-managed Prometheus keep filling up, and upgrading the chart is risky. Fix: enable Managed Prometheus and Managed Grafana, and migrate custom scrape configs to the ama-metrics-prometheus-config ConfigMap or to PodMonitor/ServiceMonitor (the managed version uses the azmonitoring.coreos.com CRD group). Limitation: alert rules must be migrated to Azure Monitor Prometheus rule groups. For details, see Prometheus & Grafana hour 3.
Case 3: an upgrade outage nobody can see
Problem: after each node image upgrade, customers reported sporadic 502 errors, but the dashboard averages looked normal. Fix: overlay the upgrade events (Drain and Surge from KubeEvents) as Grafana annotations on the 5xx curve. This revealed that the app lacked a preStop hook, so traffic still reached Pods being deleted. Limitation: events have a retention period, so long-term analysis depends on Log Analytics.
Common errors and fixes
ama-metrics / ama-logs Pod in CrashLoopBackOff, or 403 / connection timed out in the logs
Cause: outbound traffic is blocked by a firewall or UDR, or the cluster's managed identity lacks permissions on the DCR or workspace (usually configured automatically by the add-on).
kubectl logs -n kube-system -l rsName=ama-metrics -c prometheus-collector --tail=50 kubectl logs -n kube-system ds/ama-logs -c ama-logs --tail=50
Fix: allow the Azure Monitor endpoints per the AKS outbound rules, such as *.ingest.monitor.azure.com and *.handler.control.monitor.azure.com. The official outbound rules docs are the source of truth. Or use AMPLS private link.
Insights page is blank: “No data for selected filters”
Cause: the Logs and Events preset was selected (it does not include Perf or InsightsMetrics), or the data has not arrived yet. The first run takes 5–15 minutes.
Fix: switch to the Standard preset, or use Managed Prometheus and Grafana dashboards to view performance.
PromQL cannot find custom application metrics
Cause: by default, only kubelet, cAdvisor, kube-state-metrics, node-exporter, and similar targets are scraped. Application metrics must be configured explicitly.
kubectl get configmap -n kube-system | grep ama-metrics
Fix: use ama-metrics-prometheus-config or the managed CRDs (PodMonitor/ServiceMonitor). See Prometheus & Grafana hour 3.
enable-addons fails with an error related to the workspace's subscription or region
Cause: missing permissions, or resource providers not registered (such as Microsoft.Insights, Microsoft.OperationalInsights, Microsoft.Monitor).
az provider show -n Microsoft.Monitor --query registrationState az provider register -n Microsoft.Monitor
1. On a cluster with Managed Prometheus enabled, add control plane metrics collection.
az aks update -g $RG -n $OPS --enable-control-plane-metrics
2. Write a KQL query that counts logs containing “error” in the myapp namespace over the past hour, grouped by Pod.
ContainerLogV2 | where TimeGenerated > ago(1h) and PodNamespace == "myapp" | where tostring(LogMessage) has "error" | summarize count() by PodName
Finance requires cutting monitoring costs by 50%, but the SRE team does not want to lose visibility during upgrades. How would you adjust?
① Move performance metrics entirely to Managed Prometheus, which is billed by samples and is usually cheaper than sending Perf data to Log Analytics. Set Container Insights to the “Logs and Events” preset. ② Enable ContainerLogV2 and set it to Basic logs, exclude noisy namespaces, and lower the log level in apps. ③ For the control plane, collect only kube-audit-admin, not kube-audit (Module 5). ④ Keep KubeEvents (the source of upgrade events) and kube-state-metrics (PDB and Ready counts). These are the core of upgrade visibility, and their data volume is small.
Verified teaching videos
Official documentation
- Enable monitoring for AKS clusters
- Monitor AKS
- Monitor AKS control plane metrics
- This repo: Prometheus & Grafana Hour 3 (Managed Prometheus in depth)
Video storyboard (about 80 seconds)
This lesson cannot directly generate a video or MP3, so a storyboard and narration script are provided instead.
Visual: one node with two agent icons: a green ama-metrics and a blue ama-logs.
Narration: AKS monitoring has two pipelines. The Managed Prometheus agent scrapes metrics, and the Container Insights agent collects logs and events.
Visual: green data points fly to the “Azure Monitor workspace” and then to Grafana. Blue log lines fly to “Log Analytics.”
Narration: Metrics live in the Azure Monitor workspace and are queried with PromQL. Logs live in Log Analytics and are queried with KQL.
Visual: a gear labeled DCR connects both agents.
Narration: What to collect and where to send it is decided by the data collection rule.
Visual: the cost dashboard needle drops. Next to it are the ContainerLogV2 and Basic logs labels.
Narration: Use cost presets, namespace filtering, and Basic logs to control log costs.
Module 5 · Logs, diagnostic settings and control plane logs
- Distinguish the four kinds of AKS logs: activity log (ARM operations), resource logs (control plane, requires diagnostic settings), container logs (Container Insights), and Kubernetes events.
- List the resource log categories (kube-apiserver, kube-audit, kube-audit-admin, kube-controller-manager, kube-scheduler, cluster-autoscaler, cloud-controller-manager, guard, CSI controllers, and so on). Know the cost difference between kube-audit and kube-audit-admin.
- Use
az monitor diagnostic-settings create --export-to-resource-specific trueto send logs to theAKSControlPlane,AKSAudit, andAKSAuditAdmintables, and set the audit table to Basic logs. - Write common KQL: who deleted a resource, sources of 403s, cluster-autoscaler decisions, and upgrade-related activity logs.
What: where the four kinds of logs come from
| Type | Content | Collected by default? | Where to view |
|---|---|---|---|
| Activity log | ARM-level operations: create, upgrade, or stop a cluster; modify a node pool; who made the call | Yes (subscription level, retained for 90 days) | Portal Activity log; can be exported to Log Analytics through diagnostic settings |
| Resource logs (control plane) | kube-apiserver, audit, controller-manager, scheduler, autoscaler… | No. You must create a diagnostic setting. | Log Analytics (AzureDiagnostics or AKS* tables), storage account, Event Hubs |
| Container logs | Your app's stdout/stderr | After enabling Container Insights | ContainerLogV2 |
| Kubernetes events | Scheduled, Killing, FailedScheduling, Drain, Surge… | Kept only briefly in the API server (upstream --event-ttl defaults to 1 hour; AKS's actual setting should be confirmed by observation) | kubectl get events; KubeEvents table (Container Insights) |
Resource log categories (selectable in diagnostic settings)
| Category | Content | Recommendation |
|---|---|---|
kube-apiserver | API server logs | On (for troubleshooting webhook and authentication issues) |
kube-audit | All audit events (including get, list, and watch) | Very high volume. Usually don't enable, or enable only briefly. |
kube-audit-admin | Audit events, excluding get and list | On (the main source for change auditing) |
kube-controller-manager | Controller logs | As needed |
kube-scheduler | Scheduler logs | As needed |
cluster-autoscaler | Scaling decisions (why it scaled or didn't) | Enable when CA is on |
cloud-controller-manager | Cloud resource operations such as LoadBalancer and routing | When troubleshooting Service external IP issues |
guard | Entra ID / Azure RBAC authorization (Guard webhook) | Enable when Entra integration is on |
csi-azuredisk-controller, csi-azurefile-controller, csi-snapshot-controller | Storage CSI controllers | When troubleshooting PVs |
For the complete category list, see the AKS monitoring data reference, which is the source of truth. The list grows as new components are added.
How: two collection modes
| Mode | Where it writes | Pros and cons |
|---|---|---|
| Azure diagnostics mode | Everything goes to the AzureDiagnostics table, distinguished by Category. The content is in the log_s string and needs parse_json. | Legacy approach. The table has a column limit, and Basic logs cannot be used. |
| Resource-specific mode (recommended) | AKSControlPlane (non-audit categories), AKSAudit (kube-audit), AKSAuditAdmin (kube-audit-admin) | Structured columns and simpler queries. Supports Basic logs for major cost savings. |
Why: common problems and the logs that answer them
- “Who deleted the myapp Deployment in the middle of the night?” →
AKSAuditAdmin(verb=delete). - “Why didn't the node pool scale out?” →
AKSControlPlane, Category=cluster-autoscaler. - “Who upgraded the cluster? Was it auto-upgrade or a person?” → activity log (caller, operationName).
- “Why does kubectl return 403?” →
guardandResponseStatusin the audit log. - “Where did the upgrade drain get stuck?” → KubeEvents (Drain) plus
pods/evictionrequests and their 429 responses in the audit log.
When: cost and retention
- Resource logs are billed by Log Analytics ingestion. kube-audit is the largest cost driver. Official guidance: turn it off if you don't need it, use kube-audit-admin instead, and set the AKSAudit table to Basic logs.
- For long-term compliance retention, export additionally to a storage account (cheap), or use the workspace's long-term retention (archive).
- Creating a diagnostic setting with the CLI does not check the cluster's provisioning state, so confirm it took effect after creation.
Architecture diagram: where logs are generated, what they pass through, and where they land
Structure of one audit event (key columns of AKSAuditAdmin)
Animation: the audit log journey of one kubectl delete deployment
Step through how the request passes authentication, authorization, and admission, gets written to the audit backend, enters the AKSAuditAdmin table through diagnostic settings, and is finally found with KQL. Switch “categories” to see the difference between kube-audit and kube-audit-admin.
Core commands
| Command | Purpose | Key parameters |
|---|---|---|
az monitor diagnostic-settings categories list --resource ID | List the log categories supported by this cluster | — |
az monitor diagnostic-settings create | Create a diagnostic setting | --logs JSON, --workspace, --export-to-resource-specific true, --storage-account, --event-hub |
az monitor diagnostic-settings list/show/delete | Manage | --resource |
az monitor log-analytics workspace table update --plan Basic | Change tables to Basic logs | --name AKSAudit |
az monitor activity-log list | Query ARM activity logs | --resource-group, --offset, --caller |
1) Create a diagnostic setting (resource-specific, using kube-audit-admin for auditing)
AKS_ID=$(az aks show -g $RG -n $OPS --query id -o tsv)
LAW_ID=$(az monitor log-analytics workspace show -g $RG -n law-aks-lab --query id -o tsv)
az monitor diagnostic-settings categories list --resource $AKS_ID --query "value[].name" -o tsv
az monitor diagnostic-settings create --name aks-diag --resource $AKS_ID \
--workspace $LAW_ID --export-to-resource-specific true \
--logs '[{"category":"kube-apiserver","enabled":true},
{"category":"kube-audit-admin","enabled":true},
{"category":"kube-controller-manager","enabled":true},
{"category":"kube-scheduler","enabled":true},
{"category":"cluster-autoscaler","enabled":true},
{"category":"cloud-controller-manager","enabled":true},
{"category":"guard","enabled":true}]'
az monitor diagnostic-settings show --name aks-diag --resource $AKS_ID --query "{dest:logAnalyticsDestinationType, logs:logs[?enabled].category}"
{
"dest": "Dedicated",
"logs": ["kube-apiserver","kube-audit-admin","kube-controller-manager","kube-scheduler","cluster-autoscaler","cloud-controller-manager","guard"]
}
logAnalyticsDestinationType: Dedicated means resource-specific mode.
2) Set the audit table to Basic logs (if kube-audit is enabled)
az monitor log-analytics workspace table update -g $RG --workspace-name law-aks-lab --name AKSAudit --plan Basic
3) Common KQL
// Who deleted or modified objects in the myapp namespace
AKSAuditAdmin
| where TimeGenerated > ago(24h)
| where Verb in ("delete","patch","update","create")
| where ObjectRef.namespace == "myapp"
| project TimeGenerated, Verb, User = tostring(User.username), Resource = tostring(ObjectRef.resource), Name = tostring(ObjectRef.name), Code = toint(ResponseStatus.code), UserAgent
| order by TimeGenerated desc
// Evictions rejected by a PDB during the upgrade (429) AKSAuditAdmin | where TimeGenerated > ago(6h) | where ObjectRef.subresource == "eviction" and toint(ResponseStatus.code) == 429 | summarize rejected = count() by Ns = tostring(ObjectRef.namespace), Pod = tostring(ObjectRef.name) | order by rejected desc
// cluster-autoscaler decisions
AKSControlPlane
| where Category == "cluster-autoscaler"
| where Message has_any ("scale-up", "ScaleUp", "NotTriggerScaleUp")
| project TimeGenerated, Message
| take 50
# Who upgraded or stopped the cluster, and when (ARM activity log)
az monitor activity-log list -g $RG --offset 7d \
--query "[?resourceType.value=='Microsoft.ContainerService/managedClusters' || contains(resourceId,'agentPools')].{time:eventTimestamp,op:operationName.localizedValue,status:status.value,caller:caller}" -o table
How to verify: run kubectl label ns myapp audit-test=1, then find the verb=patch record in AKSAuditAdmin 5–10 minutes later. Common errors: querying AzureDiagnostics while using resource-specific mode (or the reverse). Fields are dynamic type, so apply tostring() before comparing.
Lab 5: Create a diagnostic setting and answer “who did what” (about 15 minutes)
Cost: kube-audit-admin on a small cluster is usually tens of MB per day. Do not leave kube-audit on for long during the lab. Security: audit logs include usernames and source IPs, so grant Log Analytics Reader on the workspace only to people who need it.
kubectl scale deploy/myapp -n myapp --replicas=5 kubectl label ns myapp owner=platform --overwrite kubectl delete pod -n myapp -l app=myapp --wait=false | head -1
upgrade and agentPools/write operations from Module 2, along with the caller and the start and end times.kubectl scale deploy/myapp -n myapp --replicas=4
Cleanup: at the end of the course, run az monitor diagnostic-settings delete --name aks-diag --resource $AKS_ID. Deleting the cluster also deletes its diagnostic settings.
Case 1: a production namespace was deleted by mistake
Problem: a CI service principal ran kubectl delete ns. Fix: AKSAuditAdmin shows the User (service principal objectId), SourceIps (CI runner), and UserAgent. Combine this with the activity log and Entra sign-in logs to locate the pipeline. Remediation: narrow Azure RBAC to namespace scope, and enable Deployment Safeguards and Azure Policy. Limitation: clusters without kube-audit-admin enabled cannot reconstruct what happened.
Case 2: audit logs reach 80 GB per day
Problem: kube-audit was enabled, and one operator was listing all Pods across the cluster every second. Fix: switch to kube-audit-admin (which excludes get and list). If AKSAudit must be kept, set it to Basic logs. Fix the operator's informer usage. Limitation: auditing read access (who read a Secret) requires kube-audit. Enable it only briefly, or export it to a storage account.
Case 3: SIEM integration
Problem: the security team uses Splunk or Sentinel. Fix: the same diagnostic setting sends data to both an Event Hub (SIEM) and Log Analytics (operations). Microsoft Sentinel can read the workspace directly. Limitation: each resource has a limit on the number of diagnostic settings (see the Azure Monitor docs), so avoid having each team create its own.
Common errors and fixes
Diagnostic setting created, but the AKSControlPlane and AKSAuditAdmin tables are empty
Cause: the first data takes 10–15 minutes. The setting may have been created in Azure diagnostics mode (data goes to AzureDiagnostics). The category may not be enabled, or the cluster may be Stopped.
az monitor diagnostic-settings show --name aks-diag --resource $AKS_ID --query logAnalyticsDestinationType
AzureDiagnostics | where ResourceType == "MANAGEDCLUSTERS" | summarize count() by Category
(BadRequest) Category 'kube-audit-admins' is not supported.
Cause: the category name is misspelled. The correct name is kube-audit-admin.
az monitor diagnostic-settings categories list --resource $AKS_ID --query "value[].name" -o tsv
KQL error: Failed to resolve scalar expression named 'log_s'
Cause: the AzureDiagnostics query syntax was used on a resource-specific table.
Fix: AKS* tables already have structured columns, so use Verb, ObjectRef, User, and so on directly.
Log Analytics cost spike
Usage | where TimeGenerated > ago(7d) | summarize GB = sum(Quantity) / 1024 by DataType | order by GB desc
Fix: turn off kube-audit, set AKSAudit to Basic logs, and filter ContainerLogV2 (Module 4).
1. List all diagnostic settings on the cluster and their destination modes.
az monitor diagnostic-settings list --resource $AKS_ID --query "[].{name:name,mode:logAnalyticsDestinationType,ws:workspaceId}" -o table2. KQL: over the past 24 hours, count write operations on Secrets (create, update, patch, delete) by user.
AKSAuditAdmin
| where TimeGenerated > ago(24h)
| where ObjectRef.resource == "secrets" and Verb in ("create","update","patch","delete")
| summarize count() by User = tostring(User.username), VerbAuditing requires recording “who read Secrets,” while finance requires controlling costs. How would you design this?
Reads (get and list) appear only in kube-audit. kube-audit-admin does not include them. Options: enable kube-audit but send it only to a storage account (a low-cost archive that meets retention requirements), while Log Analytics receives only kube-audit-admin. Or send kube-audit to the resource-specific AKSAudit table and set it to Basic logs. Also reduce the number of principals that need to read Secrets (use Key Vault CSI and Workload Identity, see hour 3).
Verified teaching videos
No verified video dedicated to the AKS audit tables (AKSAuditAdmin) was found, so a storyboard is provided below.
Official documentation
- Monitor AKS (control plane resource logs)
- AKS monitoring data reference
- AKSAuditAdmin table
- Log Analytics table plans (Basic logs)
Video storyboard (about 80 seconds)
This lesson cannot directly generate a video or MP3, so a storyboard and narration script are provided instead.
Visual: a cloud labeled “managed control plane,” with its components locked and out of sight.
Narration: AKS's control plane is managed by Microsoft. You can't see its Pods, so you can only export its logs through diagnostic settings.
Visual: the diagnostic settings panel, with kube-apiserver and kube-audit-admin checked. A huge money bag sits next to kube-audit.
Narration: Audit logs are the most valuable and also the most expensive. kube-audit-admin excludes read operations, which makes it the first choice for most teams.
Visual: the log stream splits into three tables: AKSControlPlane, AKSAudit, and AKSAuditAdmin.
Narration: With resource-specific mode, logs go into three structured tables. You can also set the audit table to Basic logs to save cost.
Visual: a KQL result highlights one row: delete deployments myapp by alice.
Narration: When an incident happens, one KQL query can answer who did what, and when.
Module 6 · Cost management: the cost analysis add-on and optimization
- Explain the components of AKS cost: node VMs (the biggest share), OS and data disks, load balancers and public IPs, outbound traffic, control plane tier (Standard/Premium), monitoring logs, and add-on services such as Defender.
- Enable the cost analysis add-on (
--enable-cost-analysis), understand its prerequisites and limits, and view costs by namespace and asset in Cost Management. - Explain the four cost categories, Idle / System / Service / Unallocated, and what “allocated by requests” means.
- List the optimization options: right-size requests, autoscaling, Spot, stopping dev clusters, reserved instances and savings plans, log costs, and cleaning up orphaned resources.
What: the cost analysis add-on
The add-on deploys an agent in the cluster (cost-agent, based on the CNCF project OpenCost) to collect usage. It reconciles that usage with Azure billing data and shows costs in the Cost Management → Cost analysis → Kubernetes clusters view, broken down by cluster, namespace, and asset (compute, network, storage).
| Prerequisites / limitations | Details |
|---|---|
| Pricing tier | The cluster must be Standard or Premium (Free is not supported). After enabling, you must disable it before you can downgrade to Free. |
| Billing type | The Kubernetes cost view supports only Enterprise Agreement (EA) and Microsoft Customer Agreement (MCA) (pay-as-you-go and MSDN subscriptions can't see it). |
| Cluster configuration | Managed identity; Azure Disk CSI driver; access to the required FQDNs, including ARM; CLI ≥ 2.61.0 |
| Scale | Agent memory is about 200 MB + 0.5 MB per container, capped at 4 GB, supporting about 7,000 containers |
| Not supported | Virtual nodes; some sovereign cloud regions |
| Latency | Data appears up to 24 hours after enabling. Cost data is usually finalized in 8–24 hours. |
| Identity | When enabled, a managed identity named cost-analysis-identity is created (read-only on the node resource group) and assigned to the node pool. Commands that use the node's managed identity must then specify the identity explicitly. |
| View permissions | Owner / Contributor / Reader / Cost Management Contributor / Cost Management Reader on the subscription |
How: cost categories
| Cost type | Meaning | Typical optimization |
|---|---|---|
| Namespace cost | Node cost allocated to workloads by their use of node resources (requests and actual usage) | Right-size requests (VPA recommendations) |
| Idle charges | Capacity on a node that no workload is using | Cluster Autoscaler / NAP, right-sized VM SKUs, bin-packing |
| System charges | Capacity that AKS reserves on each node for system processes such as the kubelet and the container runtime | Larger VM sizes spread the fixed reservation further (a trade-off against failure domain size) |
| Service charges | Service-related charges, such as the Uptime SLA (Standard tier) and Defender for Containers | Free tier for non-production (but cost analysis requires Standard) |
| Unallocated charges | Costs that cannot be allocated to a namespace | Clean up orphaned disks and IPs, and tag resources |
Why: the three stages of FinOps
- Inform: cost analysis + tags (
--tags costcenter=…; node pool tags propagate to the VMSS) so every dollar has an owner. - Optimize: tune requests, scale, use Spot, stop idle clusters, and use reserved instances / Azure savings plans (commit to 1- or 3-year compute usage).
- Operate: budgets and alerts (Cost Management Budgets), regular reviews (module 8).
When: quick reference for optimization levers
| Lever | Best for | Caveat |
|---|---|---|
| Cluster Autoscaler / NAP | Workloads with peaks and troughs | Requires accurate requests; see hour 4 |
| Spot node pool | Interruptible batch jobs, CI | Can be evicted; use taints and tolerations |
Scale user pool to 0 / az aks stop | Dev/test clusters outside working hours | Stop limitations: see module 7 |
| Reserved instances / savings plans | Stable baseline capacity | Pair with autoscaling: only buy for the minimum baseline |
| Logging costs | Log Analytics bill is large | ContainerLogV2 + Basic logs and kube-audit-admin from modules 4 and 5 |
| Upgrade surge cost | Large pools, frequent upgrades | Surge nodes are billed per minute; set maxSurge and the upgrade window sensibly |
Architecture: where cost data comes from
How the cost of one node is split (conceptual diagram)
Interactive calculator: adjust requests and node count to see how the cost is allocated
Simplified model (for teaching): 4 vCPU per node, 0.3 vCPU system reserved; the hourly cost per node is adjustable; namespace cost is allocated by CPU share of max(requests, actual usage); the remainder is Idle. Real OpenCost also considers CPU, memory, GPU and storage.
Hourly cost per node (USD, example) 0.21
myapp requests (per replica, m) 100m × 4 replicas
myapp actual usage (per replica, m) 60m
batch requests (total vCPU) 2
Core commands
| Command | Purpose | Key parameters |
|---|---|---|
az aks update --enable-cost-analysis | Enable cost analysis | Cluster must be Standard/Premium (can be used together with --tier standard) |
az aks update --disable-cost-analysis | Disable | Must disable before downgrading to the Free tier |
az aks update --tier standard|premium|free | Change pricing tier | Premium for LTS |
az aks nodepool update --tags / az aks update --tags | Cost tags | Node pool tags are applied to the VMSS |
az consumption budget create | Budgets and alerts (can also be created in the portal under Cost Management) | --amount, --time-grain |
1) Enable and verify
az aks show -g $RG -n $OPS --query sku.tier -o tsv # must be Standard or Premium az aks update -g $RG -n $OPS --enable-cost-analysis az aks show -g $RG -n $OPS --query "metricsProfile.costAnalysis" -o json kubectl get pods -n kube-system | grep -i cost
Standard
{
"enabled": true
}
cost-analysis-agent-7d9f8b6c5d-x2k8p 3/3 Running 0 4m
The exact name of the agent Pod depends on what is actually running in your cluster (the official troubleshooting docs call it cost-agent). Confirm the field path metricsProfile.costAnalysis against the actual output of az aks show.
2) Tag namespaces and node pools with cost labels
kubectl label ns myapp costcenter=cc-1001 team=web --overwrite az aks nodepool update -g $RG --cluster-name $OPS -n apppool --tags costcenter=cc-1001 env=lab
3) Find over-provisioned workloads (requests far above actual usage)
kubectl top pod -n myapp kubectl get pod -n myapp -o custom-columns=NAME:.metadata.name,CPU_REQ:.spec.containers[*].resources.requests.cpu,MEM_REQ:.spec.containers[*].resources.requests.memory
# Ratio of CPU requests to actual usage (> 3 indicates over-provisioning)
sum by (namespace) (kube_pod_container_resource_requests{resource="cpu"})
/ sum by (namespace) (rate(container_cpu_usage_seconds_total{container!=""}[30m]))
4) Find orphaned resources (a common source of Unallocated cost)
NODE_RG=$(az aks show -g $RG -n $OPS --query nodeResourceGroup -o tsv)
az disk list -g $NODE_RG --query "[?diskState=='Unattached'].{name:name,size:diskSizeGB}" -o table
az network public-ip list -g $NODE_RG --query "[?ipConfiguration==null].{name:name,ip:ipAddress}" -o table
Common mistakes: enabling it on a Free tier cluster fails with an error; on a pay-as-you-go subscription, enabling succeeds but the Kubernetes view does not appear in the portal. Production use: build showback/chargeback reports by the costcenter tag, and review the idle ratio every month.
Lab 6: enable cost analysis and create one “over-provisioned” workload (about 10 minutes, plus checking the next day)
Cost: the add-on itself is not billed separately; the agent uses a small amount of node resources. The cluster needs the Standard tier (already set up in module 0). Prerequisite: an EA or MCA subscription is required to see the Kubernetes view in the portal; otherwise, complete only the command steps.
kubectl create ns batch kubectl create deployment idle-batch -n batch --image=registry.k8s.io/pause:3.10 --replicas=3 kubectl set resources deploy/idle-batch -n batch --requests=cpu=1,memory=1Gi kubectl label ns batch costcenter=cc-2002
These 3 Pods request 3 vCPU but barely use any CPU. In the cost view, the batch namespace will show a noticeable cost.
aks-lab-ops → Namespaces / Assets. Record the cost share of myapp, batch, Idle and System.kubectl set resources deploy/idle-batch -n batch --requests=cpu=50m,memory=64Mi # or delete it outright kubectl delete ns batch
Cleanup: az aks update -g $RG -n $OPS --disable-cost-analysis (or just delete the cluster when the course ends).
Case 1: chargeback for a shared cluster
Problem: 12 teams share one cluster, and all costs are charged to the platform team. Approach: enable cost analysis, give each team its own namespace plus a costcenter label; export Cost Management data each month for showback, and split Idle and System costs across teams by their share. Limitations: only available for EA/MCA; for workloads that span clusters, align by namespace name.
Case 2: idle share at 45%
Problem: 3 extra nodes were kept running long-term to leave room for upgrade surge. Approach: enable the Cluster Autoscaler (surge nodes are created temporarily during upgrades and don't need permanent headroom); lower requests by 40% based on VPA recommendations; buy a 1-year savings plan for the baseline capacity. Result: idle dropped to about 15%. Limitations: scale-out takes minutes, so keep moderate headroom for latency-sensitive services.
Case 3: overnight shutdown of dev clusters
Problem: 10 dev clusters run 24×7. Approach: use Azure Automation or a scheduled pipeline to run az aks stop at 8 PM and az aks start at 8 AM (module 7). Limitations: start may fail in regions with tight capacity; disks and IPs are still billed while stopped; clusters using NAP cannot be stopped.
Common errors and fixes
Enable fails: cost analysis is not supported on Free tier clusters (illustrative)
Cause: the cluster is on the Free tier.
az aks update -g $RG -n $OPS --tier standard --enable-cost-analysis
cost-agent Pod OOMKilled or Pending
Cause: container count near the limit (about 7,000, with a 4 GB memory limit), or not enough node resources to schedule it.
kubectl get pods -n kube-system | grep -i cost kubectl describe pod -n kube-system COST_AGENT_POD | sed -n '/Events/,$p' kubectl get pods -A --no-headers | wc -l
Fix: see the official AKS cost analysis add-on issues; for very large clusters, split them or reduce the container count.
No “Kubernetes clusters” view in the portal's Cost analysis
Cause: the subscription is not EA/MCA; cost analysis was enabled less than 24 hours ago; or the viewer lacks permission.
Fix: confirm the subscription type (Cost Management → Properties); grant the Cost Management Reader role; wait one day.
az login --identity on a node suddenly uses the wrong identity
Cause: after enabling, the node pool has an extra cost-analysis-identity, so IMDS no longer has a single default identity.
az login --identity --resource-id <managed identity resource ID>
1. Upgrade a Free tier cluster to Standard and enable cost analysis at the same time.
az aks update -g $RG -n $OPS --tier standard --enable-cost-analysis
2. List the unattached disks in the node resource group.
az disk list -g $(az aks show -g $RG -n $OPS --query nodeResourceGroup -o tsv) --query "[?diskState=='Unattached'].name" -o tsv
The cost view shows idle cost at 50%, yet the nodes' actual CPU usage is only 20%, and the scheduler is already reporting Insufficient cpu. Is that contradictory? How would you handle it?
Not contradictory: scheduling only looks at requests. Heavily reserved but unused requests usually show up as higher namespace costs in the cost model (allocated by requests), while capacity that no request claims is what counts as Idle. High Idle together with Insufficient cpu usually comes from resource fragmentation (each node has a little left over but none can fit a large Pod), DaemonSets or system reservations, or Pod affinity constraints. To handle it: right-size requests (using VPA recommendations), choose an appropriate VM size, enable scale-down in the Cluster Autoscaler, check topology constraints, and use NAP for bin-packing where needed.
Verified teaching videos
Official documentation
Video storyboard (about 75 seconds)
This lesson cannot directly generate a video or MP3, so a storyboard and narration script are provided instead.
On screen: an Azure bill with only three lines: VMs, disks, IPs.
Narration: The Azure bill only knows about virtual machines and disks. It doesn't know about namespaces.
On screen: a node is sliced into colored bars: system reserved, myapp, batch, idle.
Narration: The cost analysis add-on is based on OpenCost. It splits node costs by workload, and whatever is left unused is idle cost.
On screen: the idle bar gets shorter as autoscaling runs, and the cost figure drops.
Narration: Right-sizing requests, enabling autoscaling, and stopping clusters you don't use are the three most direct ways to save money.
Module 7 · Stop/Start, Certificate Rotation and Routine Maintenance
- Explain what
az aks stopdoes (drains all nodes, releases the control plane and nodes, saves state) and its limitations (VMSS only, NAP not supported, state kept for at most 12 months, standalone Pods are lost, the API server IP may change, wait 15–30 minutes before starting, capacity risk). - Distinguish between cluster-level stop and node pool-level
az aks nodepool stop(the system pool cannot be stopped). - List the certificates in AKS (cluster CA, API server, kubelet client and server, service account tokens, kubectl client), and know which ones rotate automatically, which need
az aks rotate-certs, and what the impact of that is. - Set up a routine check: cluster status, version support, certificates, quotas, node health, events, cost and alerts.
What: cluster stop/start
az aks stop drains all nodes, then stops and deallocates the node VMs, and releases the control plane, which eliminates all compute cost. The cluster objects (everything in etcd except standalone Pods) are saved, and az aks start restores them from etcd.
| Limitations / behavior | Details |
|---|---|
| Scope | Only clusters with VMSS node pools; clusters using NAP cannot be stopped |
| Retention | State is kept for at most 12 months; after that, it cannot be restored |
| While stopped | Only start or delete are allowed; scaling and upgrades require starting first |
| Standalone Pods | Pods not managed by a controller are deleted (this lesson's prober) |
| After starting | The API server IP may change; the Cluster Autoscaler's node count may temporarily fall outside min/max; private clusters recreate the API server private endpoint (placed in the subnet of the first node pool) |
| Timing | Wait 15–30 minutes after stopping before starting; stop takes longer when PDBs are present (drain) |
| Webhook | Validating/Mutating webhooks that act on cluster-scoped resources (nodes, leases, clusterroles, or wildcard rules) can cause stop to be rejected (ValidationError) |
| Capacity risk | Released capacity may not be obtainable again in constrained regions, so not recommended for critical production clusters |
| Still billed | OS/data disks, public IPs, Log Analytics, ACR, etc. (see pricing for details) |
| Auto-upgrade | Stopped node pools are still “upgraded” during auto-upgrade, and the changes are applied at start; if the cluster is Stopped when the maintenance window begins, maintenance cannot run |
Node pool level: az aks nodepool stop/start stops all VMs in a user pool (the system pool cannot be stopped; Spot pools are supported; the pool's Cluster Autoscaler also stops while the pool is stopped; stopped pools can be upgraded; NAP clusters are not supported). Good for turning off a GPU pool overnight.
What: certificates in AKS
| Certificates | Issuer | Rotation method |
|---|---|---|
| Cluster CA | AKS generates it for each cluster; clusters created after May 2019 have a 30-year validity period (2 years before that) | Manual: az aks rotate-certs |
| API server certificate | Cluster CA | Refreshed automatically when the CA rotates |
| Service account token | Projected token; kubelet renews it automatically | Refreshed when the CA rotates |
| Kubelet client certificate | Cluster CA (TLS bootstrapping; 1.32+ uses AKS secure TLS bootstrapping, which depends on the node's Entra identity) | Automatic rotation by default (clusters created after 2022-03 with Kubernetes RBAC enabled) |
| Kubelet serving certificate | Signed by the cluster CA when KSCR (kubelet serving certificate rotation) is enabled; otherwise self-signed by the node | KSCR: enabled by default for new pools in 1.27+; nodes are labeled kubernetes.azure.com/kubelet-serving-ca=cluster |
| kubectl client certificate (local accounts) | Cluster CA | After a CA rotation, run az aks get-credentials --overwrite-existing again |
Two upcoming changes: starting 2027-04-01, AKS will no longer honor the node pool label aks-disable-kubelet-serving-certificate-rotation=true that is used to disable KSCR; starting 2026-11-30, issuing kubelet client certificates requires a dedicated Azure RBAC DataAction (this affects external nodes that use custom roles; AKS-managed nodes are expected to be unaffected).
How: what az aks rotate-certs does
- Generates a new cluster CA and refreshes the SA token, API server certificate, kubelet client certificates, and (when KSCR is enabled) kubelet serving certificates.
- Rebuilds all nodes, VMSSs and disks, which can cause up to about 30 minutes of downtime.
- Old kubeconfigs stop working immediately:
x509: certificate signed by unknown authority; you must re-fetch credentials. External services that run against the cluster and cache the CA (such as kubeconfigs in CI, or external monitoring) must also be updated. - If it fails,
az aks showshows the status as Certificate Rotating / Failed; you can run it again.
When: when a manual CA rotation is needed
- Suspected leak of the CA private key or of the cluster admin kubeconfig (the local-account clusterAdmin certificate). Enabling
--disable-local-accountsreduces this risk at the root (hour 3). - A compliance policy requires periodic rotation (for example, yearly).
- Older clusters created before May 2019 (their CA expires after two years).
Routine maintenance checklist (weekly / monthly)
| Frequency | Check | Command / location |
|---|---|---|
| Daily (alerts) | Nodes NotReady, Pod restarts, PDB disruptionsAllowed=0 persisting, API 5xx | Managed Prometheus recommended alert rules |
| Weekly | Cluster provisioningState/powerState, last week's upgrade records, Quarantined nodes, orphaned resources | az aks show, activity log, kubectl get nodes -L kubernetes.azure.com/upgrade-status |
| Monthly | Version support status and the next minor upgrade plan, Azure Advisor recommendations, quotas, cost (idle ratio) | az aks get-upgrades, Advisor, Cost analysis |
| Quarterly | Certificates and credentials (service principal secrets, Key Vault certificates), disaster recovery drills, runbook updates | Module 8 review |
certificate-authority-data in the kubeconfig changes too, so everyone has to re-fetch credentials.Certificate hierarchy and rotation scope
Cluster stop/start state machine
State machine simulation: stop/start and rotate-certs
After you choose an action, play it step by step and watch the state changes of the cluster, nodes, kubeconfig and workloads, along with the command output you would see.
Core commands
| Command | Purpose | Details |
|---|---|---|
az aks stop / start | Stop / start the whole cluster | Check powerState.code |
az aks nodepool stop / start --nodepool-name | Stop / start a user pool | CLI ≥ 2.38.0; the system pool cannot be stopped |
az aks rotate-certs | Rotate the cluster CA and child certificates | Rebuilds all nodes; up to about 30 minutes of downtime |
az aks get-credentials --overwrite-existing | Update kubeconfig | Required after a CA rotation |
az vmss run-command invoke | Checks on the node | Check kubelet certificate expiry |
az aks update (no parameters) | Reconcile cluster state | Common recovery steps for failed states |
1) Cluster stop/start
az aks stop -g $RG -n $OPS
az aks show -g $RG -n $OPS --query "{state:provisioningState,power:powerState.code}" -o table
# wait at least 15–30 minutes, then:
az aks start -g $RG -n $OPS
kubectl get nodes; kubectl get pod -n myapp
State Power --------- ------- Succeeded Stopped ... NAME READY STATUS RESTARTS AGE myapp-6d5f7c9b8-2kq8n 1/1 Running 0 3h ← AGE is counted from the original creation time redis-7c4b9f8d6-q7m2x 1/1 Running 0 3h (prober is gone: standalone Pods are deleted on stop)
2) Node pool stop/start
az aks nodepool stop -g $RG --cluster-name $OPS --nodepool-name apppool
az aks nodepool show -g $RG --cluster-name $OPS -n apppool --query "{state:provisioningState,power:powerState.code}" -o table
kubectl get pod -n myapp # myapp can only schedule onto the user pool → Pending
az aks nodepool start -g $RG --cluster-name $OPS --nodepool-name apppool
3) Check certificate expiry
# Cluster CA (from kubeconfig)
kubectl config view --raw -o jsonpath="{.clusters[?(@.name == '$OPS')].cluster.certificate-authority-data}" | base64 -d | openssl x509 -noout -subject -enddate
# API server certificate
curl -sv https://$(az aks show -g $RG -n $OPS --query fqdn -o tsv) -k 2>&1 | grep -i "expire"
# Node kubelet client certificate
NODE_RG=$(az aks show -g $RG -n $OPS --query nodeResourceGroup -o tsv)
VMSS=$(az vmss list -g $NODE_RG --query "[?contains(name,'apppool')].name" -o tsv)
az vmss run-command invoke -g $NODE_RG -n $VMSS --instance-id 0 --command-id RunShellScript \
--scripts "openssl x509 -in /var/lib/kubelet/pki/kubelet-client-current.pem -noout -enddate" --query "value[0].message" -o tsv
# Whether KSCR is enabled
kubectl get nodes -L kubernetes.azure.com/kubelet-serving-ca
kubectl get csr --field-selector=spec.signerName=kubernetes.io/kubelet-serving
subject=CN = ca notAfter=Nov 14 09:40:12 2056 GMT ← 30 years * expire date: Nov 14 09:51:03 2028 GMT [stdout] notAfter=Nov 16 10:02:44 2027 GMT NAME STATUS ... KUBELET-SERVING-CA aks-apppool-12345678-vmss000000 Ready ... cluster
The original jsonpath example uses the ?(@.name == '') placeholder; the cluster name in kubeconfig defaults to the cluster name. Confirm instance-id against the actual values from az vmss list-instances.
4) Rotate the cluster CA (causes downtime; optional in this lab)
az aks rotate-certs -g $RG -n $OPS --yes kubectl get nodes # old kubeconfig: x509: certificate signed by unknown authority az aks get-credentials -g $RG -n $OPS --overwrite-existing kubectl get nodes
Lab 7: stop/start + certificate check (about 45 minutes, including waiting)
Goal: experience the real impact of stop/start, and write a certificate expiry report for the cluster. Cost: VM and control plane costs are saved while stopped (disks and IPs are still billed). Risk: if canadacentral is short on capacity, start may need to be retried.
kubectl get pod -A --no-headers | wc -l
az aks show -g $RG -n $OPS --query "{fqdn:fqdn,ip:privateFqdn}" -o table
nslookup $(az aks show -g $RG -n $OPS --query fqdn -o tsv)time az aks stop -g $RG -n $OPS
Observe: the myapp PDB makes drain a bit slower.
time az aks start -g $RG -n $OPS nslookup $(az aks show -g $RG -n $OPS --query fqdn -o tsv) # compare the API server IP kubectl get pod -n myapp
Expected: myapp and redis recover (AGE is calculated from the original creation time); prober is lost, so rebuild it with the commands from module 0.
az aks rotate-certs, watch the output of prober (after it is rebuilt), and record the length of the interruption.Cleanup: none. If you're not continuing today, you can run az aks stop again.
Case 1: the dev cluster won't come up on Monday morning
Problem: a cluster stopped on Friday failed to start on Monday with a regional capacity error (AllocationFailed). Approach: switch to a node pool-level stop (keeping the control plane and system pool running), or scale the dev cluster's user pool down to 0; don't use stop for critical dev environments. Limitations: a node pool stop saves less, because the system pool and control plane keep running.
Case 2: cluster-admin kubeconfig of a departed employee
Problem: an employee who had downloaded --admin credentials left the company. Approach: run az aks rotate-certs in a maintenance window to invalidate all certificate-based credentials, then enable --disable-local-accounts so only Entra identities can access the cluster. Limitations: about 30 minutes of downtime; the CA cached in CI systems and external monitoring must also be updated.
Case 3: metrics-server reports x509 errors
Problem: some tools connect directly to the kubelet on port 10250 and report certificate errors after KSCR is enabled, because serving certificates are now signed by the cluster CA. Approach: update the tool's certificate path or CA trust (the certificate is at /var/lib/kubelet/kubelet-server-current.pem). Limitations: starting 2027-04-01, the label that disables KSCR no longer takes effect, so fix the tools in advance.
Common errors and fixes
Unable to connect to the server: x509: certificate signed by unknown authority (possibly because of "crypto/rsa: verification error" ...)
Cause: the CA has been rotated, but the local kubeconfig still has the old CA.
az aks get-credentials -g $RG -n $OPS --overwrite-existing
az aks stop returns ValidationError (webhook related)
Cause: a Validating/Mutating webhook acts on cluster-scoped resources (nodes, leases, clusterroles) or uses wildcard rules.
kubectl get validatingwebhookconfigurations,mutatingwebhookconfigurations
kubectl get validatingwebhookconfiguration NAME -o jsonpath='{.webhooks[*].rules}'
Fix: narrow the rules (avoid *), use scope: Namespaced + namespaceSelector, or failurePolicy: Ignore, or temporarily remove the webhook before stopping.
Operation is not allowed because the managed cluster is in stopped state (illustrative)
Cause: the Stopped state only allows start / delete.
az aks show -g $RG -n $OPS --query powerState.code az aks start -g $RG -n $OPS
rotate-certs failed partway through; cluster status Failed / Certificate Rotating
az aks show -g $RG -n $OPS --query "{state:provisioningState,power:powerState.code}"
az aks rotate-certs -g $RG -n $OPS --yes # official guidance: run it again if it failsnodepool stop error: cannot stop system node pool (illustrative)
Cause: the system pool cannot be stopped. Fix: stop only the user pools, or stop the whole cluster.
1. Write a script: if the cluster's powerState is Running, stop it; otherwise, start it.
P=$(az aks show -g $RG -n $OPS --query powerState.code -o tsv) if [ "$P" = "Running" ]; then az aks stop -g $RG -n $OPS --no-wait; else az aks start -g $RG -n $OPS --no-wait; fi
2. List the nodes that have KSCR enabled.
kubectl get nodes -l kubernetes.azure.com/kubelet-serving-ca=cluster
A team wants to stop a staging cluster every night to save money. The cluster uses NAP, has a private API server, and relies on standalone Pods, apart from a monitoring DaemonSet, for health probing. Evaluate the plan.
A cluster using NAP cannot be stopped. Change it to a non-NAP cluster, or use a different way to save money (NAP itself scales down idle nodes, and once user workloads scale to 0, NAP reclaims the nodes). If you move to a non-NAP cluster: a private cluster recreates the API server private endpoint at start (in the subnet of the first node pool), so DNS, the private DNS zone and jump host configuration must be able to handle that. Standalone Pods are lost on stop, so they must be changed to Deployments. After starting, wait for the nodes to be Ready and the workloads to recover before running staging's automated tests. Also watch the capacity risk and the 12-month state retention limit.
Verified teaching videos
Certificate rotation (az aks rotate-certs): no verified video found; see the storyboard below.
Official documentation
- Stop and start an AKS cluster
- Stop and start node pools
- Certificate management and rotation overview
- Manage and rotate certificates
Video storyboard: certificate rotation (about 70 seconds)
This lesson cannot directly generate a video or MP3, so a storyboard and narration script are provided instead.
On screen: a certificate tree, with the root “Cluster CA, 30 years” and the branches API server, kubelet, and service account tokens.
Narration: AKS's cluster certificate authority is valid for 30 years and must be rotated manually. Kubelet certificates renew automatically.
On screen: rotate-certs runs, the whole tree changes color, and nodes rebuild one by one while a timer runs to thirty minutes.
Narration: Rotation generates a new root certificate and rebuilds all nodes, which can cause up to about thirty minutes of downtime.
On screen: an x509 error appears in the developer's terminal, and then get-credentials restores access.
Narration: After rotation, every old kubeconfig stops working, so everyone has to re-fetch credentials.
Module 8 · Operations Review
- Use a scorecard to assess the Day-2 operations maturity of an AKS cluster: version, upgrade settings, PDBs, auto-upgrade and windows, observability, auditing, cost, certificates and credentials.
- Write an upgrade runbook: prepare → pre-check → execute → observe → verify → roll back.
- Use the interactive troubleshooting tree to locate common causes of upgrade failure: PDBs, quotas, subnets, deprecated APIs, windows, versions, and certificates.
- Design an upgrade game day: on staging, simulate PDB blocking, insufficient quota, and rollback.
What: what the operations review assesses
| Area | What “good” looks like | Evidence (command / location) |
|---|---|---|
| Version | Running a community-supported or LTS version; no more than N-1 behind; the next minor upgrade date is known | az aks show, get-upgrades |
| Auto-upgrade | Cluster channel stable/patch; node OS channel NodeImage/SecurityPatch; both aksManaged* windows ≥ 4 hours | autoUpgradeProfile, maintenanceconfiguration list |
| Upgrade settings | User pool maxSurge 33% (or a justified value); drainTimeout matches the longest termination; undrainable-node-behavior Cordon | nodepool list --query upgradeSettings |
| Workload resilience | Critical services with ≥ 2–3 replicas, PDBs allowing ≥ 1 disruption, probes and preStop, topology spread | kubectl get pdb -A |
| Capacity | Quota ≥ max surge; subnet headroom; VMSS not approaching 1000 | az vm list-usage |
| Observability | Managed Prometheus + alert rules; Container Insights (cost preset); upgrade events visible | Module 4 |
| Auditing | Resource-specific diagnostic settings: kube-audit-admin, guard, apiserver; retention meets compliance requirements | Module 5 |
| Cost | Cost analysis enabled; Idle < 30%; complete tags; budget alerts | Module 6 |
| Credentials and certificates | --disable-local-accounts; certificate check records; monitoring for service principal secret expiry | Module 7, hour 3 |
| Process | Upgrade runbook, rollback plan, notifications (Event Grid / Communication Manager), drill records | This module |
How: upgrade runbook (template)
- Prepare (T-7 days): read the AKS release notes and the breaking changes for the target version; staging has been running the target version for ≥ 1 week; kubent reports nothing; confirm quota and subnets.
- Pre-check (T-1 hour):
get-upgrades; PDBs showdisruptionsAllowed ≥ 1; no Quarantined nodes; alert silencing policy in place; notify the relevant teams. - Execute: control-plane-only → system pool → user pools (non-critical first, critical last); use blue-green for critical pools.
- Observe (soak period for each pool): 5xx, P99, Pending Pods, number of Ready nodes, drain events, 429s in AKSAuditAdmin.
- Verify: all nodes on the new version; surge nodes deleted; prober and synthetic monitoring healthy; no cost anomalies.
- Roll back:
rollbackon the node pool within 7 days; for blue-green, uncordon the old pool; the control plane cannot be rolled back, so rely on staging validation. - Review: record the duration, interruption seconds, issues, and improvement items.
Why: the value of an operations review
Most AKS upgrade incidents are not caused by defects in AKS itself, but by configuration drift: PDBs written wrong, too few replicas, quota not requested, windows too short, versions allowed to go stale. A quarterly review catches these chronic problems before the upgrade.
When: cadence
- Before each minor upgrade: the pre-check part of the runbook.
- Quarterly: the full scorecard.
- Every six months: a game day (PDB blocking, insufficient quota, rollback, stop/start failure).
Day-2 operations loop
Triage for upgrade failures
Interactive scorecard: your cluster's Day-2 operations maturity
Check the items your cluster already meets (you can start by checking based on aks-lab-ops's current state). The scorecard calculates the score for each area in real time and gives the top 3 improvement items with their matching commands. Checkbox state is kept only on the current page and is not written to storage.
Review script: collect all the evidence in one run
#!/usr/bin/env bash
# Usage: RG=rg-aks-lab CL=aks-lab-ops ./ops-review.sh
set -euo pipefail
echo "== Version and support"
az aks show -g $RG -n $CL --query "{ver:currentKubernetesVersion,tier:sku.tier,plan:supportPlan,state:provisioningState,power:powerState.code}" -o table
az aks get-upgrades -g $RG -n $CL -o table
echo "== Auto-upgrade and windows"
az aks show -g $RG -n $CL --query autoUpgradeProfile -o table
az aks maintenanceconfiguration list -g $RG --cluster-name $CL --query "[].{name:name,dur:maintenanceWindow.durationHours,start:maintenanceWindow.startTime,utc:maintenanceWindow.utcOffset}" -o table
echo "== Node pool upgrade settings"
az aks nodepool list -g $RG --cluster-name $CL --query "[].{pool:name,mode:mode,ver:currentOrchestratorVersion,img:nodeImageVersion,surge:upgradeSettings.maxSurge,unavail:upgradeSettings.maxUnavailable,drain:upgradeSettings.drainTimeoutInMinutes,soak:upgradeSettings.nodeSoakDurationInMinutes,undrain:upgradeSettings.undrainableNodeBehavior}" -o table
echo "== PDB (disruptionsAllowed=0 is an upgrade-blocking risk)"
kubectl get pdb -A -o custom-columns=NS:.metadata.namespace,NAME:.metadata.name,ALLOWED:.status.disruptionsAllowed,HEALTHY:.status.currentHealthy | awk 'NR==1 || $3=="0"'
echo "== Quarantined nodes"
kubectl get nodes -l kubernetes.azure.com/upgrade-status=Quarantined
echo "== Monitoring, audit, cost"
az aks show -g $RG -n $CL --query "{prom:azureMonitorProfile.metrics.enabled,ci:addonProfiles.omsagent.enabled,cost:metricsProfile.costAnalysis.enabled,localAccounts:disableLocalAccounts}" -o table
az monitor diagnostic-settings list --resource $(az aks show -g $RG -n $CL --query id -o tsv) --query "[].{name:name,mode:logAnalyticsDestinationType}" -o table
echo "== Quota (example: DSv5 family)"
az vm list-usage -l $(az aks show -g $RG -n $CL --query location -o tsv) --query "[?contains(name.value,'standardDSv5Family')].{name:name.localizedValue,used:currentValue,limit:limit}" -o table
== Node pool upgrade settings Pool Mode Ver Img Surge Unavail Drain Soak Undrain ---------- ------ ------ ----------------------------------------- ----- ------- ----- ---- ------- systempool System 1.36.5 AKSUbuntu-2204gen2containerd-202611.03.0 33% 0 30 0 apppool User 1.36.5 AKSUbuntu-2204gen2containerd-202611.03.0 1 0 15 2 Cordon == PDB (disruptionsAllowed=0 is an upgrade-blocking risk) NS NAME ALLOWED HEALTHY
The JMESPath field names (such as upgradeSettings.undrainableNodeBehavior, nodeSoakDurationInMinutes, addonProfiles.omsagent) should be confirmed against the actual output of az aks nodepool show -o json / az aks show -o json; if a field doesn't exist, it shows as empty.
Upgrade notifications
# Subscribe to AKS Event Grid events (such as a new version becoming available, or node pool upgrades starting or finishing), delivered to a webhook / Service Bus AKS_ID=$(az aks show -g $RG -n $OPS --query id -o tsv) az eventgrid event-subscription create --name aks-upgrade-events --source-resource-id $AKS_ID \ --endpoint https://example.invalid/hooks/aks --included-event-types \ Microsoft.ContainerService.NewKubernetesVersionAvailable \ Microsoft.ContainerService.ClusterSupportEnding Microsoft.ContainerService.ClusterSupportEnded \ Microsoft.ContainerService.NodePoolRollingStarted Microsoft.ContainerService.NodePoolRollingSucceeded Microsoft.ContainerService.NodePoolRollingFailed
The six event types above were verified against the Azure Event Grid AKS event schema (ClusterSupportEnding can serve as an early warning that a version is about to expire); example.invalid is a placeholder address.
Lab 8: run an operations review and an upgrade game day on aks-lab-ops (about 20 minutes)
review-$(date +%F).txt.kubectl patch pdb myapp-pdb -n myapp --type merge -p '{"spec":{"maxUnavailable":0}}'
kubectl get pdb -n myapp # ALLOWED DISRUPTIONS = 0
az aks nodepool upgrade -g $RG --cluster-name $OPS -n apppool --node-image-only --no-wait
kubectl get nodes -L kubernetes.azure.com/upgrade-status -wExpected: because of undrainable-node-behavior Cordon, the first node's drain times out (after 15 minutes) and is marked Quarantined; the upgrade continues, or stops once max-blocked-nodes is reached. If the cluster is already on the latest image, this command won't trigger an upgrade. In that case, you can instead observe a manual kubectl drain to demonstrate the 429.
kubectl patch pdb myapp-pdb -n myapp --type merge -p '{"spec":{"maxUnavailable":1}}'
kubectl label nodes -l kubernetes.azure.com/upgrade-status=Quarantined kubernetes.azure.com/upgrade-status-
az aks update -g $RG -n $OPS # reconcile stateaz aks delete -g $RG -n $OPS --yes --no-wait az monitor account delete -g $RG -n amw-aks-lab --yes az monitor log-analytics workspace delete -g $RG -n law-aks-lab --yes --force
Case 1: three “time bombs” found in the quarterly review
Findings: ① one cluster is still on N-3, and the platform-initiated upgrade month is 6 weeks away; ② 3 namespaces have PDBs with disruptionsAllowed=0; ③ the subscription's vCPU quota only covers a surge of 2 nodes. Actions: complete the minor upgrade within two weeks; fix the PDBs; request more quota. Result: avoided an uncontrolled platform upgrade.
Case 2: upgrade notifications routed to the on-call system
Approach: the NodePoolRollingFailed event from Event Grid → Logic App → PagerDuty; NewKubernetesVersionAvailable → the ticketing system automatically creates an “evaluate new version” task. Limitations: events only tell you what happened; the root cause still requires checking events and audit logs.
Case 3: AKS Automatic also needs reviews
Problem: the team assumed an Automatic cluster was “fully automatic,” but one service with only 1 replica and a strict PDB blocked the automatic upgrade. Approach: the “workload resilience” item in the scorecard applies here too; the Deployment Safeguards preset by Automatic can warn you, but they cannot replace good design.
Interactive troubleshooting tree: AKS upgrade and operations failures
Step through the symptoms you observe to reach diagnostic commands and fix suggestions.
Supplement: frequent errors
Upgrade did not start in maintenance window and cluster is now out of support
Check whether the channel is none, whether the window is ≥ 4 hours, and whether the cluster is Stopped. Once the version expires, auto-upgrade no longer takes effect, and you need to upgrade manually in full.
OperationNotAllowed: Another operation (Upgrading) is in progress
az aks show -g $RG -n $OPS --query provisioningState az aks operation-abort -g $RG -n $OPS # abort cluster-level operations if necessary az aks nodepool operation-abort -g $RG --cluster-name $OPS -n apppool
1. Find all PDBs with disruptionsAllowed at 0 using one command.
kubectl get pdb -A -o jsonpath='{range .items[?(@.status.disruptionsAllowed==0)]}{.metadata.namespace}/{.metadata.name}{"\n"}{end}'2. List all ARM write operations run against aks-lab-ops in the past 7 days, along with their callers.
az monitor activity-log list -g $RG --offset 7d --query "[?contains(resourceId,'aks-lab-ops') && contains(operationName.value,'write')].{t:eventTimestamp,op:operationName.value,who:caller,st:status.value}" -o tableYou've taken over 15 AKS clusters with no documentation at all. What do you do in the first week?
① Inventory: use the review script to collect each cluster's version, tier, channel, windows, node pool settings, diagnostic settings, and cost analysis status; compare against the calendar to mark clusters at N-3 or about to expire, and the platform-initiated upgrade months. ② Stop the bleeding: enable diagnostic settings (kube-audit-admin) and basic managed Prometheus alerts on all clusters, fix PDBs with disruptionsAllowed=0, and schedule upgrades for clusters at risk of expiry. ③ Set a rhythm: set channels and windows per environment (staggered windows to avoid ARM throttling), and introduce Fleet to manage phased upgrades. ④ Write the runbook and run a game day on staging.
Verified teaching videos
Official documentation
- AKS patch and upgrade guidance (Architecture Center)
- Well-Architected: AKS service guide
- AKS as an Event Grid source
- AKS release notes
Video storyboard (about 70 seconds)
This lesson cannot directly generate a video or MP3, so a storyboard and narration script are provided instead.
On screen: a ring diagram: plan, execute, observe, review.
Narration: Day-2 operations is a loop. Plan the versions and windows, execute the upgrade, observe metrics and logs, then review on a regular basis.
On screen: red items on the scorecard: PDB allowed disruptions at zero, insufficient quota, version N-3.
Narration: A review looks for configuration drift: PDBs written wrong, quota that isn't enough, versions about to expire.
On screen: runbook cards flip through: pre-check, execute, observe, verify, roll back.
Narration: Write these steps into the upgrade playbook and rehearse them in a test environment, so the real upgrade goes smoothly.
Command cheat sheet
Version and support
az aks get-versions -l $LOC -o table
az aks get-upgrades -g $RG -n $CL -o table
az aks show -g $RG -n $CL --query "{v:currentKubernetesVersion,tier:sku.tier,plan:supportPlan}"
# LTS (Premium)
az aks update -g $RG -n $CL --tier premium \
--k8s-support-plan AKSLongTermSupport --auto-upgrade-channel patch
kubent --target-version 1.36.0Step-by-step upgrade
az aks upgrade -g $RG -n $CL --kubernetes-version 1.36.5 --control-plane-only --yes az aks nodepool upgrade -g $RG --cluster-name $CL -n systempool --kubernetes-version 1.36.5 az aks nodepool upgrade -g $RG --cluster-name $CL -n apppool --kubernetes-version 1.36.5 --no-wait kubectl get events -A --field-selector reason=Drain kubectl get events -A --field-selector reason=Surge
Upgrade settings
az aks nodepool update -g $RG --cluster-name $CL -n apppool \ --max-surge 33% --drain-timeout 30 --node-soak-duration 2 \ --undrainable-node-behavior Cordon --max-blocked-nodes 1 # in place (insufficient quota; not for the system pool) az aks nodepool upgrade ... --max-surge 0 --max-unavailable 1 # last resort (bypasses deprecated APIs and PDBs) az aks upgrade ... --enable-force-upgrade --upgrade-override-until 2026-11-20T13:00:00Z
Rollback and blue-green
az aks nodepool get-rollback-versions -g $RG --cluster-name $CL -n apppool az aks nodepool rollback -g $RG --cluster-name $CL -n apppool az aks nodepool operation-abort -g $RG --cluster-name $CL -n apppool # blue-green az aks nodepool add ... -n appgreen --kubernetes-version 1.36.5 kubectl cordon -l agentpool=apppool kubectl drain NODE --ignore-daemonsets --delete-emptydir-data
Node image, channel, windows
az aks nodepool get-upgrades -g $RG --cluster-name $CL --nodepool-name apppool az aks nodepool upgrade -g $RG --cluster-name $CL -n apppool --node-image-only az aks update -g $RG -n $CL --auto-upgrade-channel stable --node-os-upgrade-channel NodeImage az aks maintenanceconfiguration add -g $RG --cluster-name $CL \ --name aksManagedNodeOSUpgradeSchedule --schedule-type Weekly \ --day-of-week Sunday --interval-weeks 1 --duration 4 --utc-offset -05:00 --start-time 02:00 az aks maintenanceconfiguration list -g $RG --cluster-name $CL -o table
Monitoring
az aks update -g $RG -n $CL --enable-azure-monitor-metrics \ --azure-monitor-workspace-resource-id $AMW_ID --enable-control-plane-metrics az aks enable-addons -g $RG -n $CL --addon monitoring \ --workspace-resource-id $LAW_ID --data-collection-settings dcs.json kubectl get ds ama-logs ama-metrics-node -n kube-system kubectl get deploy ama-logs-rs -n kube-system
Diagnostic settings and audit
az monitor diagnostic-settings categories list --resource $AKS_ID -o table
az monitor diagnostic-settings create --name aks-diag --resource $AKS_ID \
--workspace $LAW_ID --export-to-resource-specific true \
--logs '[{"category":"kube-audit-admin","enabled":true},{"category":"kube-apiserver","enabled":true}]'
az monitor log-analytics workspace table update -g $RG \
--workspace-name law-aks-lab --name AKSAudit --plan BasicCost, stop/start, certificates
az aks update -g $RG -n $CL --enable-cost-analysis # Standard/Premium az aks stop -g $RG -n $CL ; az aks start -g $RG -n $CL az aks nodepool stop -g $RG --cluster-name $CL --nodepool-name apppool az aks rotate-certs -g $RG -n $CL --yes # up to about 30 minutes of downtime az aks get-credentials -g $RG -n $CL --overwrite-existing kubectl get nodes -L kubernetes.azure.com/kubelet-serving-ca
Quick troubleshooting table
| Symptom | Most likely cause | First command | Module |
|---|---|---|---|
| Cannot evict pod as it would violate the pod's disruption budget | PDB does not allow disruption | kubectl get pdb -A | M2 |
| UpgradeBlockedOnDeprecatedAPIUsage | Removed API used within the last 12 hours | kubent | M1 |
| NotAllAgentPoolOrchestratorVersionSpecifiedAndUnchanged | control-plane-only performed while auto-upgrade is enabled | az aks show --query autoUpgradeProfile | M2/M3 |
| SubnetIsFull / AllocationFailed | Insufficient IPs or capacity for surge | az vm list-usage | M2 |
| Auto-upgrade did not happen | Channel none / window < 4h / cluster Stopped / expired | maintenanceconfiguration list | M3 |
| No data in AKSAuditAdmin | No diagnostic settings, or AzureDiagnostics mode is used | diagnostic-settings list | M5 |
| Kubernetes not visible in the cost view | Free tier / not EA·MCA / less than 24h | az aks show --query sku.tier | M6 |
| x509: certificate signed by unknown authority | CA has been rotated | az aks get-credentials --overwrite-existing | M7 |
Recommended configuration snippet (production user pool)
resource "azurerm_kubernetes_cluster_node_pool" "app" {
name = "apppool"
kubernetes_cluster_id = azurerm_kubernetes_cluster.aks.id
vm_size = "Standard_D4s_v5"
mode = "User"
upgrade_settings {
max_surge = "33%"
drain_timeout_in_minutes = 30
node_soak_duration_in_minutes = 2
}
}
# Cluster: automatic_upgrade_channel = "stable", node_os_upgrade_channel = "NodeImage"
# Maintenance windows: maintenance_window_auto_upgrade / maintenance_window_node_os blocks
# (confirm parameter names against the azurerm provider docs; newer parameters such as the undrainable behavior can be set with azapi)
Capstone lab: an auditable, rollback-ready production candidate upgrade
The platform team needs to deliver aks-lab-ops as a “production candidate” cluster. Requirements: keep the version at N-1 and follow automatically; node images update automatically every week, but only on Sunday early morning; during upgrades, myapp's interruption must be < 5 seconds (Redis's interruption must be reported separately); all changes must be auditable; cost must be visible per namespace; the handover includes an operations review report.
RG=rg-aks-lab CL=aks-lab-ops bash ops-review.sh | tee review-before.txt
kubectl patch deploy myapp -n myapp --type json -p '[{"op":"add","path":"/spec/template/spec/containers/0/lifecycle","value":{"preStop":{"sleep":{"seconds":5}}}}]'--max-surge 33% --drain-timeout 15 --node-soak-duration 2 --undrainable-node-behavior Cordon --max-blocked-nodes 1; systempool --max-surge 33%.az aks nodepool upgrade -g $RG --cluster-name $OPS -n apppool --node-image-only --no-wait kubectl logs -n myapp prober -f | grep -v " 200$"
stable + NodeImage, and create two maintenance windows (cluster: the first Sunday of each month, 6 hours; node OS: every Sunday, 4 hours, with year-end notAllowedDates).costcenter; run the review script again to generate review-after.txt; score it with the scorecard. Finally, run az aks stop or delete the cluster as needed.Acceptance checklist
Open-ended self-check (6 questions)
1. Why is “control-plane-only first, then pool by pool” recommended, while it can't be done once auto-upgrade is enabled? How can you have both?
A staged upgrade lets you validate API compatibility first (the control plane cannot be rolled back), then observe each pool and keep the 7-day node pool rollback option. Auto-upgrade upgrades the control plane and all pools together. To have both: keep prod on the patch channel and orchestrate minor upgrades manually through the pipeline (staged), or run the stable channel on staging for a week first, then roll out to prod in phases with Fleet.
2. What are the effects of maxSurge=33% and maxUnavailable=1 on capacity, speed and interruption?
maxSurge adds temporary capacity (it requires quota and IPs), and the number of nodes drained at once equals the surge count, which speeds things up. maxUnavailable adds no capacity; it directly reduces available nodes, which suits cases with limited quota but leaves the remaining nodes more crowded and makes PDB blocking more likely. The rollback strategy when both are > 0 is currently in Preview.
3. What is the essential difference between a platform-initiated upgrade and the auto-upgrade channel? How do you avoid the former?
Auto-upgrade respects the channel and maintenance windows, and is subject to deprecated API checks and PDB constraints. Platform-initiated upgrades target clusters that have expired plus a 60-day grace period; they ignore windows, skip deprecated API checks, can override PDBs, and cannot be rolled back. To avoid them: always stay on a community-supported or LTS version, use the stable or patch channel with windows, and subscribe to the ClusterSupportEnding event.
4. NodeImage or SecurityPatch?
NodeImage: a new VHD every week, includes bug fixes, reimages on each update, no extra VHD cost, supports Windows. SecurityPatch: faster pure security patches, applied in place for most workloads and reimaged only when necessary, has extra VHD cost, does not support Windows, and conflicts with CMK deny policies. Choose SecurityPatch for speed and less interruption; choose NodeImage for complete fixes and simplicity.
5. Why is the kube-audit-admin + resource-specific mode recommended?
kube-audit-admin excludes get/list and keeps all change events, which greatly reduces data volume and cost. Resource-specific mode writes to structured tables such as AKSAuditAdmin, which makes queries simple and supports Basic logs.
6. When should you not use az aks stop?
Business-critical clusters (capacity may not be obtainable again after release), clusters using NAP (not supported), environments that depend on standalone Pods or a fixed API server IP, periods when maintenance or upgrades must run during downtime, and clusters that might go unstarted for more than 12 months.
Sources and versions
| Topic | Verified conclusion | Source (page update date) |
|---|---|---|
| Version calendar and support policy | Community support 1.35/1.36/1.37 (N-2); 1.34 community support ends 2026-11; 1.38 preview planned for 2026-11, GA 2027-02; platform support N-3 + 60-day grace period; platform-initiated upgrades from 2027-06-01; default N-1; patches for at least 2 months; non-LTS clusters cannot skip minor versions; control plane can lead node pools by up to 3 minor versions | Supported Kubernetes versions (ms.date 2026-09-15, updated 2026-10-21); Upgrade control plane (2026-07-30) |
| LTS | Requires Premium tier + --k8s-support-plan AKSLongTermSupport; 1 year community + 1 year LTS; latest two patches only; Calico not supported | Long-term support (2026-08-05, updated 2026-11-07) |
| AKS release notes | Release 2026-10-25: 1.37 reaches GA and becomes LTS; 1.36 becomes the default for new clusters; patches 1.37.1 / 1.36.5 / 1.35.9 / 1.34.12; node pool rollback GA (released 2026-08-07); blue-green pool Preview; LocalDNS default in 1.37+; Windows Server 2022 not supported in 1.37+ | github.com/Azure/AKS/releases (accessed 2026-11-16) |
| Rolling upgrade parameters | Surge process has 6 steps; maxSurge recommended at 33% (one doc gives the default as 1 node; another says max-blocked-nodes defaults to maxSurge, “usually 10%”); 1.35+ falls back to surge 1; maxUnavailable defaults to 0 and is not available for the system pool; drain defaults to 30 minutes (5–1440); soak 0–30; VMSS limit of 1000 | Configure rolling upgrades (2026-05-29, updated 2026-09-16) |
| Undrainable nodes, forced upgrades, preflight checks | Schedule (default) / Cordon + kubernetes.azure.com/upgrade-status=Quarantined; --max-blocked-nodes; force upgrade requires CLI 2.79+ / API 2025-09-01+, default 3 days; IP formula | Upgrade options (2026-06-22, updated 2026-10-10) |
| Deprecated APIs block upgrades | subcode UpgradeBlockedOnDeprecatedAPIUsage; 12-hour detection window; target ≥ 1.26; not applicable to platform-initiated upgrades | Stop upgrades on API breaking changes (2026-07-01) |
| Node pool rollback | CLI 2.88.0+, API 2026-04-01+, no aks-preview needed; 7 days; rolls back to the previous version only; auto-upgrade channel must be turned off; OS SKU changes are not rolled back | Roll back node pool versions (2026-08-05, updated 2026-10-10) |
| Node images | Linux weekly, Windows monthly; up to about two weeks to cover all regions; cannot downgrade; Azure Linux 2.0 images removed 2026-10-31 | Upgrade node images (2026-08-03) |
| Auto-upgrade channels | none/patch/stable/rapid/node-image (legacy); takes effect within 24 hours; cannot be control-plane-only once enabled | Auto-upgrade cluster (2026-06-26, updated 2026-10-22) |
| Node OS channels | None/Unmanaged/SecurityPatch/NodeImage; from API 2023-06-01, new Standard clusters default to NodeImage; SecurityPatch limits (Windows, CMK deny policy, CLI 2.61+) | Autoupgrade node OS images (2026-06-26, updated 2026-09-12) |
| Maintenance configuration | default / aksManagedAutoUpgradeSchedule / aksManagedNodeOSUpgradeSchedule; ≥ 4 hours; start 15 minutes ahead; best effort; shared window Preview (CLI 2.85+); CLI parameters (--week-index, etc.) | Planned Maintenance (2026-08-10, updated 2026-10-20); CLI reference (2026-09) |
| Enabling monitoring | --enable-azure-monitor-metrics, --enable-control-plane-metrics, enable-addons --addon monitoring --data-collection-settings; cost presets; agent names | Enable monitoring for AKS (2026-08-18, updated 2026-11-10) |
| Control plane logs | Category list, kube-audit cost recommendations, resource-specific mode with AKSAudit/AKSAuditAdmin/AKSControlPlane, CLI examples; AKSAuditAdmin column definitions | Monitor AKS (2026-08-18); AKSAuditAdmin (2026-07-27) |
| Cost analysis | Standard/Premium; EA/MCA; OpenCost; about 7,000 containers; 8–24 hours; cost-analysis-identity | AKS cost analysis (2026-07-29) |
| Stop/start | VMSS only, not NAP, 12 months, standalone Pod deletion, IPs may change, wait 15–30 minutes, webhook ValidationError; node pool stop cannot stop the system pool | Stop/start cluster (2026-07-21); Stop/start node pools (2026-08-12) |
| Certificates | CA lifetime 30 years (clusters created after 2019-05); rotate-certs rebuilds nodes, with up to about 30 minutes of downtime; KSCR 1.27+; from 2027-04-01 disabled labels are no longer recognized; from 2026-11-30 kubelet client certificates need a new DataAction | Certificate rotation overview (2026-10-13); Rotate certificates (2026-07-13) |
| Event Grid events | NewKubernetesVersionAvailable, ClusterSupportEnding/Ended, NodePoolRollingStarted/Succeeded/Failed | AKS as Event Grid source (updated 2026-02-25) |
Video verification notes
All videos were checked on 2026-11-16 via YouTube oEmbed (https://www.youtube.com/oembed?url=…&format=json) to confirm that titles and channels match:
oEmbed can only verify titles and channels, not durations or publish dates. Most videos were recorded before this lesson's verification date, so for version details, follow this lesson and the official docs.
Voice narration notes
The “Voice” tab uses the browser's built-in Web Speech API (speechSynthesis, with an en-US voice reading the narration and the English terms). This lesson is a single offline file, so it cannot embed MP3s. Version numbers and dates in the narration script are written out as they should be spoken, so you can pass the script directly to any TTS tool to generate audio.
Known limitations
- Commands were not run on a real subscription: all “expected output” blocks are examples. Version patch numbers (such as 1.35.9, 1.36.5), node image names, node names, IPs, times, and costs are illustrative values. Use
az aks get-versionsand your actual output as the source of truth. - maxSurge default: the two official docs word this differently (“1 extra node by default” vs. “usually 10%”). This lesson does not rely on the default; all labs set it explicitly.
- Pricing: at verification time, the AKS pricing page did not show per-unit prices for the Standard/Premium tiers, so this lesson gives only relative notes and estimates. See the official pricing page and the pricing calculator for current figures.
- Blue-green node pool upgrade strategy (
--upgrade-strategy bluegreen) is in Preview. This lesson demonstrates only a manual blue-green. For managed-version parameters, follow the aks-preview docs. - Some error messages are marked as “illustrative.” We quote verbatim only the error text that appears in the official docs (such as
UpgradeBlockedOnDeprecatedAPIUsage,NotAllAgentPoolOrchestratorVersionSpecifiedAndUnchanged, PDB eviction failures, x509). The rest are descriptions of common symptoms. - The cost analysis agent Pod name and some JMESPath field paths in
az aks show(such asmetricsProfile.costAnalysisandupgradeSettings.undrainableNodeBehavior) were not verified on a live cluster. The lesson notes “follow the actual output.” - The animations and calculator are simplified teaching models. The surge animation follows the official 6-step process. The cost calculator splits costs by CPU only, while real OpenCost also considers memory, GPU, storage, and network.
- The EKS / GKE comparisons are for conceptual reference only. Their current durations and prices were not verified item by item.