Helm Hour 3: Moving to the Cloud Platform (Azure)
- Explain on AKS who runs helm (local machine / pipeline / GitOps controller) and the identity each one needs; keep clear the boundary between AKS-managed add-ons and components installed with Helm to avoid duplicate installs.
- Treat ACR as an OCI chart repository: use
az acr login --expose-token+helm registry loginlogin, push / pull, install by digest; explain the difference between “kubelet pulling images (--attach-acr)” and “helm pulling charts” are two separate credential chains; can do chart cleanup (acr purge) and understand how SBOM / signing is mounted. - Design a “cloud-neutral but Azure-friendly” chart: ServiceAccount annotations and Pod labels parameterized,SecretProviderClass templated, so it still renders and runs on kind when the toggles are off.
- within the same chart,optionally render an Ingress or HTTPRoute, and know the status of the AKS application routing add-on: managed NGINX will after November 2026 stop receiving Azure support; the Gateway API implementation (
approuting-istio) is GA. - Identify which of the common Azure-related charts (KEDA, cert-manager, External Secrets, Secrets Store CSI) are already AKS add-ons, and the consequences of installing them twice.
- In GitHub Actions / Azure Pipelines, use OIDC to get AKS credentials,kubelogin non-interactive authentication, and run
helm upgrade --install --rollback-on-failure. - Quickly locate from the raw error message ACR 401/403, OCI reference errors, AADSTS errors, ingress not taking effect, kubelogin interactive failures, and complete cost control and cleanup per the checklist.
1-Hour Time Allocation Table
| # | Time | Module | Core Content | Animation / Interactive | Lab (AKS aks-helm-lab) |
|---|---|---|---|---|---|
| 0 | Before Class | Warm-up and AKS Preparation | Resource group, ACR, AKS (OIDC + WI + Key Vault add-on + Gateway API), Key Vault, kubelogin, Helm 4.3 | Environment Self-Check Checklist | One-Click Lab Environment Setup |
| 1 | 00–05 | Helm Deployment Architecture on AKS | Three executors: local machine / pipeline / GitOps; managed add-ons vs Helm components; layered identities | Switching executors: how identity and the call path change | Inventory the add-ons and Helm releases in the cluster |
| 2 | 05–13 | ACR as an OCI Chart Repository | Login methods, push/pull, install by digest, attach-acr vs chart credentials, ABAC roles, acr purge, SBOM/signing | Core Animation: full credential and call chain from pulling a chart from ACR to the API Server | Push the myapp chart and install it from ACR |
| 3 | 13–21 | Chart Design for Workload Identity and Key Vault | SA annotations / Pod label parameterization, SecretProviderClass templates, coupling between the federated credential subject and chart naming | Token exchange animation + values toggle render preview | myapp reads the Redis password from Key Vault |
| 4 | 21–29 | Ingress / Gateway | Application routing add-on status, Managed Gateway API, optional Ingress / HTTPRoute rendering in the chart | Entry-mode renderer | Render an HTTPRoute for myapp and access it |
| 5 | 29–37 | Common Azure-Related Charts and Add-ons | KEDA, cert-manager, External Secrets, Secrets Store CSI; add-on conflict matrix | “Install or not” conflict checker | Check existing cluster components; install cert-manager (optional) |
| 6 | 37–45 | Pipeline Deployment to AKS | OIDC → AKS credentials → kubelogin → helm upgrade --install --rollback-on-failure; Actions and Pipelines versions | One pipeline deployment (inject a failure to see automatic rollback) | GitHub Actions workflow upgrades myapp |
| 7 | 45–54 | Hands-on Troubleshooting in the Cloud | ACR 401/403, OCI reference format, AADSTS700016/70021/700212, ingress not taking effect, kubelogin interactive failures | Raw error message classifier + interactive troubleshooting tree | Inject 4 faults and fix them |
| 8 | 54–60 | Cost, Cleanup and Self-Check | Cost breakdown, stop / delete, leftover resources (Key Vault soft delete, federated credentials, role assignments) | Cost estimator | Full cleanup and verification |
| — | After Class | Cheat Sheet · Capstone Lab | Push to ACR → WI + Key Vault deployment → pipeline upgrade / rollback → cleanup | Final Quiz (12 questions) | Capstone Lab |
Knowledge Coverage Matrix
| Target Skills | M1 | M2 | M3 | M4 | M5 | M6 | M7 | M8 | Key Commands | Lab |
|---|---|---|---|---|---|---|---|---|---|---|
| Choose helm's executor and identity | ✓ | · | · | · | · | ✓ | · | · | az aks get-credentials,helm list -A | M1 Inventory |
| Distinguish add-ons from Helm components | ✓ | · | · | ✓ | ✓ | · | · | · | az aks show --query addonProfiles | M5 Check |
| ACR OCI chart push / pull / digest | · | ✓ | · | · | · | ✓ | ✓ | · | helm push,helm registry login | M2 Lab |
| Image credentials vs chart credentials | ✓ | ✓ | · | · | · | ✓ | ✓ | · | az aks check-acr | M7 Fault 1 |
| Workload Identity parameterization | · | · | ✓ | · | ✓ | · | ✓ | · | az identity federated-credential create | M3 Lab |
| SecretProviderClass templating | · | · | ✓ | ✓ | ✓ | · | ✓ | · | kubectl describe pod (FailedMount) | M3 Lab |
| Optional Ingress / HTTPRoute rendering | · | · | · | ✓ | · | · | ✓ | · | helm template --set ingress.mode=gateway | M4 Lab |
| Pipeline OIDC + kubelogin + automatic rollback | ✓ | · | · | · | · | ✓ | ✓ | · | kubelogin convert-kubeconfig -l azurecli | M6 Lab |
| Cloud error diagnosis | · | ✓ | ✓ | ✓ | · | ✓ | ✓ | · | helm --debug,kubectl get events | M7 Fault Injection |
| Cost Control and Cleanup | · | ✓ | · | · | · | · | · | ✓ | az aks stop,az group delete | M8 Cleanup |
Topics Excluded from This Lesson (and Where to Learn Them)
| Topic | Why Not in This Lesson | Where to Learn |
|---|---|---|
| Helm basics: chart / release / values / rollback intro | Covered as an overview in K8s course Hour 6; already taught in Lesson 1 of this course | K8s Hour 6 Module 1 · Helm Lesson 1 |
| Template syntax, _helpers.tpl, values.schema.json | Lesson 2 topic; this lesson only adds cloud-related templates | Helm Lesson 2 |
| OIDC principles of Workload Identity, projected token details | Mechanics covered in K8s course Hour 5; this lesson only covers chart design | K8s Hour 5 Module 3 · Module 7 (Key Vault CSI) |
| Gateway API resource model, ingress-nginx retirement background | Covered in the K8s networking lesson | K8s Hour 3 Module 6 |
| GitHub / Azure DevOps side configuration for OIDC federated credentials | Belongs to the CI platform topic | GitHub Lesson 3 Module 2 · Azure DevOps Lesson 3 Module 2 |
| chart-testing, chart-releaser, signing, Argo CD / Flux | Lesson 5 “Automated Operations” | Helm Lesson 5 |
| AKS cluster architecture (networking, upgrades, NAP, Automatic) | Platform topic, not Helm | AKS 8 hours(comparison of the three managed clusters is in K8s Hour 6 Module 7) |
How to Use This Courseware
Principles · Diagrams · Animation · Commands · Labs · Production Cases · Troubleshooting · Quiz · Voice · Video. Cloud labs incur costs. Read “Principles” and “Animation” first, then do all the labs in one session, and run the Module 8 cleanup right after.
A quiz score of 70% or higher, or clicking “Mark this module complete,” counts toward progress, saved in this browser (cleared on refresh if local storage is blocked).
The “Voice” page reads the narration script aloud with the browser's built-in Web Speech API (en-US), with English terms pronounced in en-US; without a Chinese voice pack, the script can still be read.
--atomic renamed --rollback-on-failure,--force renamed --force-replace (the old name still works but emits a warning); new installs default to server-side apply,helm registry login accept only hostnames. AKS follows 1.37 (GA in 2026-10). Application routing add-on: managed NGINX (Ingress API) stops receiving Azure support after November 2026, the Gateway API implementation approuting-istio went GA in 2026-06 and is enabled by default on new AKS Automatic 1.36+ clusters. Azure commands and prices follow learn.microsoft.com and the Azure pricing page.az group delete, forgetting to delete it costs about 150–250 USD per month.Module 0 · Warm-up and AKS Preparation (complete before class)
- Completed Helm Lesson 2: you have a local
myapp/chart (Deployment, Service, ConfigMap, optional Redis,values.schema.json,_helpers.tplin themyapp.fullname/myapp.labels/myapp.serviceAccountName). If your named templates use different names, replace the ones used in this lesson's templates with your own chart'sinclude. - the myapp image from the Docker course (Flask + gunicorn,
/healthz, reading the Redis connection from environment variables or a file). This lesson usesaz acr buildto build in the cloud; no Docker is needed locally. - Tools: Azure CLI ≥ 2.86 (required for application routing Gateway API), Helm v4.3.x, kubectl 1.37, kubelogin v0.2.x, jq.
- Azure permissions: have Owner, or Contributor + Role Based Access Control Administrator——
--attach-acrand Key Vault / AKS RBAC role assignments both require “write role assignments” permission. Lacking this permission is the most common stumbling block in this lesson.
Step 1: Variables and Tool Check
export RG=rg-helm-lab LOC=canadacentral export AKS=aks-helm-lab export ACR=acrhelmlab$RANDOM # globally unique, 5–50 alphanumeric characters export KV=kv-helm-lab-$RANDOM # globally unique, 3–24 characters export NS=myapp echo "ACR=$ACR KV=$KV" | tee ~/helm-lab.env # note these down; later lessons and cleanup need them az version --query '"azure-cli"' -o tsv helm version --short kubectl version --client kubelogin --version
2.86.0 v4.3.2+g1b2c3d4 Client Version: v1.37.1 Kustomize Version: v5.7.1 kubelogin version git hash: v0.2.22/... Go version: go1.25.x
Helm not upgraded to 4.x? Use the official script curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-4 | bash; kubectl and kubelogin can be az aks install-cli installed in one go.
Step 2: Resource Group, ACR, Key Vault
az group create -n $RG -l $LOC az acr create -g $RG -n $ACR --sku Basic # Basic is enough for labs; only Premium has private endpoints / geo-replication / retention policies az keyvault create -g $RG -n $KV -l $LOC --enable-rbac-authorization true # Grant yourself permission to write secrets (a Key Vault in RBAC mode does not allow anyone to read or write the data plane by default) ME=$(az ad signed-in-user show --query id -o tsv) az role assignment create --role "Key Vault Secrets Officer" --assignee-object-id $ME \ --assignee-principal-type User --scope $(az keyvault show -n $KV --query id -o tsv) az keyvault secret set --vault-name $KV -n redis-password --value "$(openssl rand -base64 24)"
secret set if you get Forbidden ... does not have secrets set permission, wait a minute and retry.Step 3: Create AKS (enable all the capabilities this lesson needs at once)
az aks create -g $RG -n $AKS -l $LOC \ --tier free --node-count 2 --node-vm-size Standard_D2s_v5 \ --network-plugin azure --network-plugin-mode overlay \ --enable-oidc-issuer --enable-workload-identity \ --enable-aad --enable-azure-rbac \ --enable-addons azure-keyvault-secrets-provider \ --enable-gateway-api --enable-app-routing-istio \ --attach-acr $ACR \ --generate-ssh-keys
| Parameter | Use in This Lesson | Related Module |
|---|---|---|
--enable-oidc-issuer --enable-workload-identity | The cluster issues SA tokens that Entra trusts; installs the WI mutating webhook | M3 |
--enable-aad --enable-azure-rbac | kubectl / helm authenticate with Entra tokens and are authorized with Azure RBAC → kubelogin is required | M1, M6, M7 |
--enable-addons azure-keyvault-secrets-provider | Managed Secrets Store CSI Driver + Azure provider (do not install it again with Helm) | M3, M5 |
--enable-gateway-api --enable-app-routing-istio | Managed Gateway API CRDs + application routing Gateway API implementation (GatewayClass approuting-istio) | M4 |
--attach-acr | Grant the kubelet managed identity the AcrPull role—this only solves “nodes pulling images”, not “helm pulling charts” | M2 |
If your CLI version does not recognize --enable-app-routing-istio, first az upgrade; or skip these two parameters for now, and in Module 4 use az aks update --enable-gateway-api --enable-app-routing-istio to enable them.
Step 4: kubelogin, Credentials and Your Own RBAC Roles
AKS_ID=$(az aks show -g $RG -n $AKS --query id -o tsv) az role assignment create --role "Azure Kubernetes Service RBAC Cluster Admin" \ --assignee-object-id $ME --assignee-principal-type User --scope $AKS_ID az aks get-credentials -g $RG -n $AKS --overwrite-existing kubelogin convert-kubeconfig -l azurecli # reuse the az login token, no device-code prompt kubectl get nodes kubectl get gatewayclass
NAME STATUS ROLES AGE VERSION aks-nodepool1-31718369-vmss000000 Ready <none> 6m v1.37.1 aks-nodepool1-31718369-vmss000001 Ready <none> 6m v1.37.1 NAME CONTROLLER ACCEPTED AGE approuting-istio istio.io/gateway-controller True 4m
Step 5: Build the myapp Image into ACR
cd ~/myapp-src # myapp source directory from the Docker course (contains the Dockerfile) az acr build -r $ACR -t myapp:1.0.0 -t myapp:1.1.0 . az acr repository show-tags -n $ACR --repository myapp -o tsv
az acr build Build it in ACR Tasks; no Docker is needed locally. Two tags are applied so Module 6 can demonstrate “upgrade to 1.1.0, then roll back”.
Warm-up: answer from memory (30 seconds)
What credentials does helm itself use to connect to Kubernetes?
Like kubectl, it reads the kubeconfig ($KUBECONFIG / ~/.kube/config), and calls the API Server directly through client-go; there are no Helm server-side components in the cluster. So whether helm can deploy depends entirely on what permissions the identity in the kubeconfig has in Kubernetes RBAC (or Azure RBAC for AKS).
Where is the release state stored?
The default storage driver is Secret: the release records are stored as sh.helm.release.v1.<release>.v<revision>. This means the deploying identity needs permission to read and write Secrets in that namespace; this is often overlooked when designing least-privilege access on AKS.
oci:// Can you write https:// in the reference?
No. An OCI reference is oci://<registry>/<repo>/<chart>; helm registry login in Helm 4 it is stricter: only hostnames (with an optional port) are accepted.
Module 1 · Helm Deployment Architecture on AKS
- Compare three executors: the engineer's local machine,CI/CD pipeline (push model),the in-cluster GitOps controller (pull model), and state where each identity comes from and when each fits.
- Draw the three identity layers involved in one deployment: the registry identity that pulls the chart, the Kubernetes identity that calls the API Server, and the workload identity a Pod uses at runtime to access Azure.
- Decide whether a component should be managed by an AKS add-on / extension or by your own Helm release , and know the risks of mixing the two.
What: what “deployment architecture” means on AKS
Helm 4 is still purely a client: it reads the chart → merges values → renders → calls the API Server through client-go (new installs default to server-side apply) → writes the release record as a Secret in the namespace. So on AKS, the architecture question comes down to three things:
- where the helm process runs: an engineer's laptop, a pipeline agent (GitHub-hosted runner / Azure Pipelines agent), or a controller in the cluster (Flux helm-controller, Argo CD).
- what identity it uses: an ACR identity to pull the chart, and an Entra identity (converted to a token via kubelogin) or a local account certificate to call the API Server.
- which components it is responsible for: business charts, platform charts (cert-manager, etc.), or nothing at all, leaving it to AKS add-ons.
Why: why define the architecture first
The same chart with a different executor needs completely different permissions, network paths and auditing. The common incident is not a template bug but: the pipeline uses cluster-admin credentials (--admin), the GitOps controller cannot pull charts from a private ACR, or someone reinstalls KEDA, which AKS already manages, with Helm, so two external metrics servers fight each other.
How: comparing the three executors
| Local machine (manual) | Pipeline (push model) | GitOps (pull model) | |
|---|---|---|---|
| Where helm runs | Engineer's computer | CI agent / runner | In-cluster controller (Flux helm-controller embeds the Helm SDK; Argo CD uses helm template to render, then applies it itself) |
| Kubernetes identity | Personal Entra account (kubelogin azurecli/devicecode) | An Entra app or user-assigned managed identity, via OIDC federation (keyless) | The controller's ServiceAccount (in-cluster; usually has broad permissions) |
| ACR chart identity | az acr login Personal token | The same federated identity + AcrPull / Repository Reader | The controller's workload identity or the kubelet identity (depends on tool support) |
| API Server network | Must be reachable (private clusters need a VPN / jump box) | Hosted runners reach the public endpoint; private clusters need a self-hosted agent or az aks command invoke | in-cluster access; private clusters are a natural fit |
| Auditing | Weakest (who ran helm upgrade and when is recorded only in the release Secret) | Pipeline run records + approvals | Git commit history + controller events |
| Best for | Labs, emergency troubleshooting | The starting point for most teams; this lesson's M6 | Multi-cluster, strong drift correction; Lesson 5 |
Three identity layers (recurring throughout this lesson)
| Layer | Who uses it | How it is implemented on Azure | Related Modules |
|---|---|---|---|
| ① Registry identity | helm (pulls/pushes charts), kubelet (pulls images) | helm: helm registry login ACR token; kubelet: --attach-acr AcrPull granted to the kubelet managed identity | M2 |
| ② Kubernetes identity | helm calls the API Server | Entra token (kubelogin) + Azure RBAC / Kubernetes RBAC; read/write permission on release Secrets | M6, M7 |
| ③ Workload identity | Pod runtime, CSI driver | ServiceAccount annotation + federated credential → Entra token → Key Vault, etc. | M3 |
AKS add-ons / extensions vs your Helm release
| AKS add-on | AKS cluster extension | Your own Helm release | |
|---|---|---|---|
| How it is enabled | az aks enable-addons / az aks update --enable-xxx | az k8s-extension create (the underlying layer is a Helm chart, managed by ARM) | helm upgrade --install |
| Lifecycle | Managed by AKS; within the same Kubernetes minor, only patches are upgraded; upgraded along with the minor version | Managed by the extension resource provider; auto-upgrade can be set | You are responsible for upgrades, CVEs and compatibility |
| Support | Azure support | Azure support | Community (AKS support policy does not cover self-managed open-source components) |
| Customizability | Low (for example, the KEDA add-on does not allow changing Helm values) | Medium | High |
helm list -A Visible? | Not visible (not your release) | Usually not visible (managed by the extension agent) | Yes |
When: how to choose
- Platform components (Key Vault CSI, KEDA, Gateway, monitoring): prefer the add-on when one exists, unless you need a configuration or version it does not support.
- Business charts: start with pipeline push, and move to GitOps once there are more environments; use local helm only for labs and emergency troubleshooting, and write the change back to Git afterward.
- Pipeline identity: never use
az aks get-credentials --admin(local admin certificates bypass Entra and auditing); production clusters can directly--disable-local-accounts.
Comparison with Similar Technologies
| Helm on AKS | AKS cluster extension | Azure Container Apps | |
|---|---|---|---|
| Deployment unit | chart → release | Azure resource (internally a chart) | Container App revision (no Helm) |
| Who executes | You choose (local machine / pipeline / GitOps) | ARM | ARM |
| State storage | In-cluster Secret | ARM + cluster | ARM |
--attach-acr After running it, helm can pull charts from ACR”—attach only grants permission to the kubelet on the nodes; your helm process (on a laptop or runner) never uses it. ③ “Add-ons are also installed by Helm, so I can helm upgrade it”—add-ons do not show up in your helm list list; manual edits to their resources get reconciled back by AKS.Architecture diagram: three executors, three identity layers
Decision flow: who should install a component?
Interactive demo: switch executors and see how the identity and call path change
Choose an executor, then click “Step through”. Each step shows the request helm (or the controller) actually sends, the credentials it uses, and who performs authentication and authorization on AKS.
Core commands: inventory “who installed what”
| Command | Purpose | Notes |
|---|---|---|
az aks show --query addonProfiles | Lists classic add-ons (Key Vault CSI, monitoring, policy, etc.) | Newer capabilities (WI, Gateway API, KEDA, application routing) appear in securityProfile,workloadAutoScalerProfile,ingressProfile fields such as |
az k8s-extension list -t managedClusters | Lists cluster extensions (Flux, Dapr, etc.) | Extensions are built on Helm charts but are managed by ARM |
helm list -A | Lists only Helm releases (records in the storage-driver Secrets) | Add-ons do not appear here |
kubectl get secret -A -l owner=helm | Inspect the release storage directly | Labels owner=helm,name,status,version |
kubectl auth whoami | current kubeconfig identity | Entra user shows UPN / object ID; used to confirm the pipeline uses the identity you expect |
az aks get-credentials [--admin] | Write kubeconfig | --admin Uses a local admin certificate, bypassing Entra; disable in production (--disable-local-accounts) |
az aks show -g $RG -n $AKS --query "{addons:addonProfiles, wi:securityProfile.workloadIdentity, oidc:oidcIssuerProfile.enabled, ingress:ingressProfile, keda:workloadAutoScalerProfile.keda}" -o json
{
"addons": {
"azureKeyvaultSecretsProvider": { "enabled": true, "config": { "enableSecretRotation": "false" }, ... }
},
"wi": { "enabled": true },
"oidc": true,
"ingress": { "gatewayAPI": { "installation": "Standard" },
"webAppRouting": { "gatewayAPIImplementations": { "appRoutingIstio": { "mode": "Enabled" } } } },
"keda": null
}
helm list -A kubectl get secret -A -l owner=helm kubectl auth whoami
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION No resources found ATTRIBUTE VALUE Username alice@contoso.com Groups [b3c1… system:authenticated] Extra: oid [4f2a…]
How to verify: The cluster already runs many Pods such as Key Vault CSI, the WI webhook and istiod, but helm list -A is empty—none of them are Helm releases. Common mistake: Seeing kube-system a csi driver in it and assuming “helm upgrade is needed for it”. Production use: Put these three commands into the cluster handover checklist.
Lab 1: inventory the cluster's “owners” (about 4 min)
kubectl get pods -n kube-system -l 'app in (secrets-store-csi-driver,secrets-store-provider-azure)' -o wide kubectl get pods -n kube-system | grep -E 'azure-wi-webhook|keda' || true kubectl get pods -n aks-istio-system
NAME READY STATUS NODE aks-secrets-store-csi-driver-7xq2m 3/3 Running aks-nodepool1-…-vmss000000 aks-secrets-store-csi-driver-kq9df 3/3 Running aks-nodepool1-…-vmss000001 aks-secrets-store-provider-azure-5tt7d 1/1 Running aks-nodepool1-…-vmss000000 aks-secrets-store-provider-azure-p2c8w 1/1 Running aks-nodepool1-…-vmss000001 azure-wi-webhook-controller-manager-… 1/1 Running NAME READY STATUS RESTARTS AGE istiod-6d8c7f9b5-2kq8d 1/1 Running 0 9m istiod-6d8c7f9b5-x7pzt 1/1 Running 0 9m
helm list -A
kubectl get ds -n kube-system aks-secrets-store-csi-driver -o jsonpath='{.metadata.labels}{"\n"}'
The labels usually show addonmanager.kubernetes.io/mode or kubernetes.azure.com/managedby a managed marker of that kind (the exact key depends on the actual output), with no app.kubernetes.io/managed-by: Helm.
kubectl config view --minify -o jsonpath='{.users[0].user.exec.command} {.users[0].user.exec.args}{"\n"}'
kubectl auth can-i create secrets -n default
kubelogin get-token --login azurecli --server-id 6dae42f8-4368-4678-94ff-3960e28e3630 yes
6dae42f8-4368-4678-94ff-3960e28e3630 is the Entra server application ID for AKS (common to all AKS-managed Entra clusters). can-i yes comes from the “Azure Kubernetes Service RBAC Cluster Admin” role assigned to you in Module 0.
README-ops.md; Module 5 will use it to decide which charts should not be installed again.Case 1: the pipeline used --admin, and every audit entry shows clusterAdmin
Problem: A security audit found that in the AKS API audit log, every deployment is made by the user clusterAdmin, which cannot be traced to a specific pipeline. Fix: Switch the pipeline to a user-assigned managed identity federated via OIDC,az aks get-credentials remove --admin, and use kubelogin to get tokens non-interactively; enable --disable-local-accounts on the cluster. Configuration: Assign that identity myapp in namespace scope the “Azure Kubernetes Service RBAC Writer” role, and on the cluster resource the “Azure Kubernetes Service Cluster User Role” (for downloading the kubeconfig). Limitation: After disabling local accounts, during an Entra outage only az aks command invoke and other ARM channels can be used as an emergency fallback.
Case 2: two KEDA installs
Problem: The platform team enabled KEDA via the add-on, and the app team's chart also bundles the KEDA chart as a dependency, so HPA shows FailedGetExternalMetric. Root cause: the cluster can have only one external.metrics.k8s.io APIService provider; the one installed later overrode the APIService. Fix: The app chart renders only ScaledObject, without KEDA itself; use .Capabilities.APIVersions.Has "keda.sh/v1alpha1" in the chart to check whether the CRD exists. Limitation: Add-on versions follow the AKS minor; to get newer features you must upgrade the cluster or switch to self-managed (disable the add-on first).
Case 3: private cluster + GitHub-hosted runner
Problem: After the cluster became private, the pipeline helm upgrade times out dial tcp 10.x.x.x:443: i/o timeout. Fix: Pick one of three: a self-hosted runner placed in the VNet; or switch to GitOps (pulling from inside the cluster); or run helm in a temporary Pod managed by AKS using az aks command invoke (suited to small-scale, command-style operations; the chart must be uploaded as a file). Limitation:command invoke Timeouts and file size limits apply, so it is not suitable as the main deployment channel.
Common errors and fixes
Error: Kubernetes cluster unreachable: Get "https://aks-helm-lab-…hcp.canadacentral.azmk8s.io:443/version": getting credentials: exec: executable kubelogin not found
Cause: An Entra cluster's kubeconfig uses the kubelogin exec plugin, which is not installed in the runtime environment.
az aks install-cli # or download the release package from github.com/Azure/kubelogin kubelogin convert-kubeconfig -l azurecli
Prevention: explicitly install kubelogin in the pipeline (azure/use-kubelogin or aks-set-context 's use-kubelogin: true).
Error: INSTALLATION FAILED: … secrets is forbidden: User "…" cannot create resource "secrets" in API group "" in the namespace "myapp"
Cause: helm must write the release Secret in the target namespace; the deploying identity was only given Deployment/Service permissions.
kubectl auth can-i create secrets -n myapp --as=<identity object ID or UPN> az role assignment list --assignee <object ID> --all -o table
Fix: Assign the “Azure Kubernetes Service RBAC Writer” role in namespace scope (includes Secret read/write), or a custom Role that includes secrets get/list/create/update/delete for it.
helm list -A is empty, but the cluster clearly has many components
Cause: They are add-ons / extensions / resources from kubectl apply, not Helm releases; or your identity lacks permission to list Secrets in other namespaces (helm list needs to read Secrets).
Diagnosis:kubectl get secret -A -l owner=helm; if you get forbidden, it is a permission problem, not “no release”.
Error: UPGRADE FAILED: … conflict with "…" using apps/v1: .spec.template.spec.containers[name="…"]… (field ownership conflict)
Cause: Helm 4 uses server-side apply by default for new installs; the same field of the resource is already owned by another manager (an add-on controller, kubectl, or another release).
Fix: Confirm who should own this resource—if it belongs to an add-on, do not manage it in the chart; details on field ownership are in the “SSA and field ownership conflicts” module of Lesson 7.
1. One command to confirm which kubelogin login mode the current kubeconfig uses.
kubectl config view --minify -o jsonpath='{.users[0].user.exec.args}{"\n"}'In the output, --login azurecli / devicecode / workloadidentity etc. indicates the mode.
2. List the storage Secrets of all Helm releases in the cluster (including status and revision number).
kubectl get secret -A -l owner=helm -L name,status,version
A team has 3 AKS clusters (dev/test/prod), and prod is a private cluster. Someone proposes “use GitHub-hosted runners for everything + the --admin credentials to run helm upgrade, the simplest approach.” How would you review this?
Objection --admin Local admin certificates bypass Entra and auditing, and stay valid long-term; switch to OIDC federated identity + kubelogin + namespace-scoped Azure RBAC. For the private prod cluster, hosted runners cannot reach the API Server: choose a self-hosted runner (inside the VNet) or GitOps; dev/test can keep the push model. Add-ons (CSI, Gateway) are managed by the cluster template (Bicep/Terraform), not by the business pipeline.
Verified teaching videos
Official docs
- Add-ons, extensions, and other integrations with AKS
- Use kubelogin to authenticate in AKS
- Manage local accounts with AKS-managed Microsoft Entra integration
- Helm Architecture
Video storyboard (about 90 seconds)
This courseware cannot generate video/MP3 directly, but storyboards and narration scripts are provided for a video tool.
Scene: a large AKS box with no “Helm server” inside; outside the frame, three figures: a laptop, a pipeline gear, and an in-cluster robot.
Narration: Helm has no server side. On AKS, the first question you must answer is: who runs helm?
Scene: three colored lines light up in turn—ACR, Entra, API Server—each with a token icon.
Narration: each deployment uses at least three identities: the repository identity that pulls the chart, the Kubernetes identity that calls the API Server, and the workload identity Pods use to access Azure at runtime.
Scene: two stacks of blocks inside the cluster, one tagged with the Azure logo (add-ons), one with the Helm wheel; someone tries to put a KEDA block into both stacks while a red warning flashes.
Narration: add-ons are managed by AKS, Helm releases are managed by you. One component can have only one owner.
Scene: the admin certificate is crossed out and replaced with an OIDC key.
Narration: don't use admin credentials in the pipeline; use federated identity plus kubelogin, so the audit log shows who did the deployment.
Module 2 · ACR as an OCI Chart Repository
- Log in to ACR in three ways:
az acr login,az acr login --expose-token+helm registry login(no-Docker environments, the preferred option for pipelines), and repository-scoped tokens. - Write OCI references correctly: push only goes to the “namespace”, install/pull goes to the chart name, and the version goes through
--version, or pin with@sha256:digest. - Explain the full call chain of one
helm upgrade --install oci://…: ACR token exchange → manifest → layers → render → kubelogin → API Server; and why kubelet pulling images needs no login from you. - Govern the chart repository: ABAC repository permissions,
acr purgecleanup (retention policies do not support OCI manifests), and SBOM / signatures attached as referrers.
What: what a Helm chart in ACR is
ACR stores charts as OCI artifacts (GA). One helm push produces one OCI image manifest: the config's mediaType is application/vnd.cncf.helm.config.v1+json (its content is the Chart.yaml metadata), with one layer application/vnd.cncf.helm.chart.content.v1.tar+gzip (which is .tgz, and if a .prov file sits beside it, a provenance layer is added too). The tag is the chart's SemVer version (OCI tags do not allow +, so Helm replaces it with _).
The old “Helm 2 style index.yaml repository” and the az acr helm command group 2025-09-15 were retired in helm repo add / helm search repo ; OCI repositories cannot be browsed with az acr repository ; use the helm show series commands or
Why: why use ACR for charts
- the chart and images share one registry, one Entra identity model and one network boundary (private endpoints, firewall), so you no longer need to run a separate chart server.
- OCI digests are immutable: production can install by
@sha256:, avoiding “the same version number being pushed again”. - SBOMs and signatures can be attached as referrer to the chart, for admission or pipeline verification.
How: three login methods
| Method | Command | Dependency | Suitable for |
|---|---|---|---|
| az acr login | az acr login -n $ACR | Requires a local Docker CLI (writes credentials to the Docker config, which Helm can also read) | Developer machine |
| --expose-token + helm registry login | az acr login -n $ACR --expose-token --query accessToken -o tsv | helm registry login $ACR.azurecr.io -u 00000000-0000-0000-0000-000000000000 --password-stdin | No Docker needed; the token is valid for about 3 hours valid | Pipelines, containers, Cloud Shell |
| Repository-scoped token (non-Entra) | az acr token create --scope-map … after helm registry login -u <token name> | Long-lived password, needs rotation | External systems that cannot use Entra (avoid if possible) |
--expose-token The returned accessToken field is actually an ACR refresh token; the username is fixed as an all-zero GUID. helm uses it against ACR's /oauth2/token endpoint to exchange for a short-lived access token per repository and per action (pull/push).
Two credential chains (the most important table in this module)
| helm pull / push chart | kubelet pulls image | |
|---|---|---|
| Who initiates | the helm process (local machine / runner / GitOps controller) | kubelet → containerd on each node |
| Identity | your Entra user / pipeline federated identity / repository token | kubelet managed identity (<cluster name>-agentpool) |
| How it is authorized | Assign AcrPull (pull) / AcrPush (push) to ACR; registries with ABAC use Container Registry Repository Reader / Writer | az aks create/update --attach-acr Automatically assigns AcrPull to the kubelet identity |
| Failure symptom | helm the command fails directly with 401/403 | Pod ErrImagePull / ImagePullBackOff, and events show 401 |
| Diagnosis | helm pull … --debug,az acr check-health | az aks check-acr -n $AKS -g $RG --acr $ACR.azurecr.io |
When: how to write references
| Operation | Correct form | Notes |
|---|---|---|
| push | helm push myapp-0.3.0.tgz oci://$ACR.azurecr.io/helm | only up to the namespace; the chart name and tag come from the tgz → gives helm/myapp:0.3.0 |
| install / upgrade | helm upgrade --install myapp oci://$ACR.azurecr.io/helm/myapp --version 0.3.0 | omitting --version takes the latest SemVer tag when omitted (do not omit in production) |
| by digest | oci://$ACR.azurecr.io/helm/myapp@sha256:<digest> | immutable, recommended for production |
| Dependencies | repository: oci://$ACR.azurecr.io/helm | do not write the chart name in the dependencies in Chart.yaml |
| Login | helm registry login $ACR.azurecr.io | Helm 4 accepts only hostnames (with an optional port); with https:// or a path it is rejected |
Governance: permissions, cleanup, SBOM
- Permissions: the release pipeline gets AcrPush (or Repository Writer, which can be scoped to
helm/*repositories); the deployment pipeline only needs AcrPull (or Repository Reader). Do not enable the ACR admin user. - Cleanup: ACR retention policy (Premium, preview) only handles untagged manifests of Docker media type; OCI manifests are not supported—Helm charts are exactly OCI manifests, so use
acr purge(ACR Tasks) to clean up by tag pattern and age; it can be configured as a scheduled task. - SBOM / signing: ACR supports OCI referrers; you can use ORAS to attach an SBOM (SPDX / CycloneDX) to the chart's digest and sign with Notation or similar tools; Helm's own
.provis pushed as a layer of the chart manifest. Signing and verification are covered in detail in Lesson 5.
Comparison with Similar Technologies
| ACR (OCI) | GitHub Pages + index.yaml (chart-releaser) | Azure Artifacts | |
|---|---|---|---|
| Protocol | OCI Distribution | HTTP + index.yaml | does not provide a Helm chart source (see official docs) |
| Authentication | Entra / repository token | public or basic authentication | — |
| Immutable reference | digest | none (only a URL) | — |
helm search | not supported | supported | — |
--attach-acr after attach, helm does not need to log in”—attach only authorizes the kubelet. ② “pushing with the full path oci://…/helm/myapp”—gives helm/myapp/myapp:0.3.0, and install cannot find it. ③ “The ACR retention policy will clean up old charts for me”—no, OCI manifests are not managed by retention policies, and retention only deletes untagged ones. ④ “az acr login will always work in pipelines”—it fails without Docker; use --expose-token.OCI chart storage structure
Two credential chains side by side
Core animation: the full credential and call chain from pulling an OCI chart from ACR to deploying on AKS
Command: helm upgrade --install myapp oci://acrhelmlab.azurecr.io/helm/myapp --version 0.3.0 -n myapp. Step through each hop to observe the HTTP request, token used and result. Turn on “Inject fault” to see at which hop each error appears.
Core commands and parameters
| Command | Purpose | Key parameters / notes |
|---|---|---|
az acr login -n $ACR --expose-token | Get the ACR refresh token (without calling Docker) | --query accessToken -o tsv; valid for about 3 hours |
helm registry login HOST | Write the registry credentials for helm | -u,--password-stdin; HOST must be a hostname only |
helm package DIR | Package as name-version.tgz | --version,--app-version overwrite Chart.yaml |
helm push TGZ oci://HOST/NS | Push | Outputs the Pushed reference and Digest |
helm show chart|values oci://… | View without downloading to disk | --version |
helm pull oci://… --version V | Download tgz | --untar,-d |
az acr repository show-tags / az acr manifest list-metadata | Browse chart versions and digests | --orderby time_desc; configMediaType Determine whether it is a chart |
az acr run --cmd "acr purge …" | Clean up by tag pattern / age | --filter,--ago,--keep,--untagged,--dry-run |
az aks check-acr | Verify image pulling from the node's perspective | Only verifies chain B, not helm |
cd ~/charts helm package myapp --version 0.3.0 --app-version 1.0.0 az acr login -n $ACR --expose-token --query accessToken -o tsv \ | helm registry login $ACR.azurecr.io -u 00000000-0000-0000-0000-000000000000 --password-stdin helm push myapp-0.3.0.tgz oci://$ACR.azurecr.io/helm
Successfully packaged chart and saved it to: /home/alice/charts/myapp-0.3.0.tgz Login Succeeded Pushed: acrhelmlab12345.azurecr.io/helm/myapp:0.3.0 Digest: sha256:9f1c6be0a52e7c1f0d4b3c2a8e5f7d9c1b0a2e4f6d8c0b2a4e6f8d0c2b4a6e8f
az acr manifest list-metadata -r $ACR -n helm/myapp \
--query "[].{tag:tags[0], digest:digest, config:configMediaType, size:imageSize}" -o table
helm show chart oci://$ACR.azurecr.io/helm/myapp --version 0.3.0
Tag Digest Config Size ----- ----------------------------------------------------------------------- ---------------------------------------- ------ 0.3.0 sha256:9f1c6be0a52e7c1f0d4b3c2a8e5f7d9c1b0a2e4f6d8c0b2a4e6f8d0c2b4a6e8f application/vnd.cncf.helm.config.v1+json 4127 apiVersion: v2 appVersion: 1.0.0 name: myapp type: application version: 0.3.0
Clean up old charts (ACR Tasks, available on Basic SKU)
# First dry-run: delete versions of helm/myapp older than 30 days, but keep at least the latest 5 az acr run -r $ACR --cmd "acr purge --filter 'helm/myapp:.*' --ago 30d --keep 5 --untagged --dry-run" /dev/null # Set as a scheduled task running at 01:00 (UTC) every Sunday az acr task create -r $ACR -n purge-charts --context /dev/null --schedule "0 1 * * Sun" \ --cmd "acr purge --filter 'helm/.*:.*' --ago 90d --keep 10 --untagged"
How to verify:az acr task list-runs -r $ACR -o table. Common mistakes: Environments deployed by digest depend on old manifests; when purging, use --keep and a long enough --ago, or lock key versions: az acr repository update -n $ACR --image helm/myapp:0.3.0 --delete-enabled false.
Attach an SBOM (optional, requires the ORAS CLI)
DIGEST=$(az acr manifest list-metadata -r $ACR -n helm/myapp --query "[?tags[0]=='0.3.0'].digest" -o tsv) oras login $ACR.azurecr.io -u 00000000-0000-0000-0000-000000000000 \ -p "$(az acr login -n $ACR --expose-token --query accessToken -o tsv)" oras attach $ACR.azurecr.io/helm/myapp@$DIGEST --artifact-type application/spdx+json ./myapp-chart.spdx.json oras discover $ACR.azurecr.io/helm/myapp@$DIGEST -o tree
Lab 2: push the myapp chart to ACR and install it from ACR (about 7 min)
cd ~/charts sed -i 's/^version:.*/version: 0.3.0/' myapp/Chart.yaml cat > values-aks.yaml <<EOF image: repository: $ACR.azurecr.io/myapp tag: "1.0.0" EOF helm lint myapp -f values-aks.yaml helm package myapp
az acr login -n $ACR --expose-token --query accessToken -o tsv \ | helm registry login $ACR.azurecr.io -u 00000000-0000-0000-0000-000000000000 --password-stdin helm push myapp-0.3.0.tgz oci://$ACR.azurecr.io/helm az acr repository list -n $ACR -o tsv
Pushed: acrhelmlab12345.azurecr.io/helm/myapp:0.3.0 Digest: sha256:9f1c… helm/myapp myapp
kubectl create namespace $NS helm upgrade --install myapp oci://$ACR.azurecr.io/helm/myapp --version 0.3.0 \ -n $NS -f values-aks.yaml --wait --timeout 5m DIGEST=$(az acr manifest list-metadata -r $ACR -n helm/myapp --query "[?tags[0]=='0.3.0'].digest" -o tsv) helm upgrade myapp oci://$ACR.azurecr.io/helm/myapp@$DIGEST -n $NS -f values-aks.yaml --wait helm history myapp -n $NS
Release "myapp" does not exist. Installing it now. Pulled: acrhelmlab12345.azurecr.io/helm/myapp:0.3.0 Digest: sha256:9f1c… NAME: myapp NAMESPACE: myapp STATUS: deployed REVISION: 1 … REVISION UPDATED STATUS CHART APP VERSION DESCRIPTION 1 … superseded myapp-0.3.0 1.0.0 Install complete 2 … deployed myapp-0.3.0 1.0.0 Upgrade complete
helm registry logout $ACR.azurecr.io kubectl rollout restart deploy -n $NS -l app.kubernetes.io/instance=myapp kubectl get pods -n $NS -w # new Pods can still pull images: that relies on attach-acr az aks check-acr -g $RG -n $AKS --acr $ACR.azurecr.io
[2026-11-15T10:12:01Z] Validating image pull permission: SUCCEEDED [2026-11-15T10:12:01Z] Your cluster can pull images from acrhelmlab12345.azurecr.io!
Then running helm show chart oci://… will return 401—the two chains do not affect each other; this is the core conclusion of this module.
az acr repository delete -n $ACR --image helm/myapp:0.3.0 --yesCase 1: the same version number was pushed again; prod and test have different content
Problem: A developer fixed the template without changing the version number and directly helm push overwrote the 0.7.2, so test deployed the old digest and prod the new one; troubleshooting took half a day. Fix: The release pipeline checks before pushing whether the tag already exists in az acr manifest show-metadata ; if it does, it fails. The deployment pipeline switches to installing by digest and records the digest in the deployment log. Configuration: Lock the published tag by running az acr repository update --write-enabled false . Limitation: Once locked, it must be manually unlocked before it can be deleted.
Case 2: ACR storage costs keep rising year after year
Problem: Each PR pushes a 0.0.0-pr123 pre-release chart, and after two years tens of thousands of tags have built up. The team assumed a retention policy was enabled and would be enough, but it had no effect. Root cause: retention policies only target untagged manifests of Docker media type; charts are tagged OCI manifests. Fix: a scheduled acr purge --filter 'helm/.*:0\.0\.0-pr.*' --ago 14d; keep the latest 20 formal releases. Limitation: purge runs on ACR Tasks and is billed by task duration (very little).
Case 3: pipeline push fails after enabling ABAC
Problem: After switching the registry to the “RBAC Registry + ABAC Repository Permissions” mode, the release pipeline that previously had AcrPush got 403. Fix: Following the official docs, change to assigning Container Registry Repository Writer and use an ABAC condition to restrict the repository prefix to helm/; assign Container Registry Repository Reader to the deployment pipeline. Limitation: Before switching modes, review all identities (including the kubelet's attach-acr role and the GitOps controller); which built-in roles still take effect in ABAC mode is per the official docs.
Common errors and fixes
Error: failed to authorize: failed to fetch oauth token: unexpected status from POST request to https://acrhelmlab.azurecr.io/oauth2/token: 401 Unauthorized
Cause: Not logged in, the refresh token has expired (about 3 hours), or the az login account is not in that tenant. The wording varies slightly with the Helm/ORAS version (it may also be response status code 401: unauthorized: authentication required).
az account show --query "{user:user.name, tenant:tenantId}" -o table
az acr login -n $ACR --expose-token --query accessToken -o tsv | helm registry login $ACR.azurecr.io -u 00000000-0000-0000-0000-000000000000 --password-stdinError: … 403 Forbidden … denied: requested access to the resource is denied
Cause: The identity authenticates but has no pull/push permission on this repository (missing AcrPull/AcrPush, or missing Repository Reader/Writer in ABAC mode, or the ABAC condition does not match the repository name).
az role assignment list --scope $(az acr show -n $ACR --query id -o tsv) -o table az acr show -n $ACR --query roleAssignmentMode -o tsv # ABAC mode shows AbacRepositoryPermissions (field name depends on CLI version)
Error: … oci://…/helm/myapp:0.3.0: not found or manifest unknown
Cause: wrong reference path (an extra chart name was written on push, so the actual path is helm/myapp/myapp), the version does not exist, or the version contains + (replaced with _ in the tag).
az acr repository list -n $ACR -o tsv az acr repository show-tags -n $ACR --repository helm/myapp -o tsv
Error: invalid_reference: invalid tag or Error: … login … host must be a hostname
Cause: the tag and --version were both written and are inconsistent, or helm registry login https://acr.azurecr.io includes a protocol / path (Helm 4 accepts only hostnames).
Fix: for install, use oci://HOST/NS/CHART --version V; for login, use HOST.
ERROR: … DOCKER_COMMAND_ERROR … Please verify if docker daemon is running
Cause:az acr login helm calls the Docker CLI by default, and there is no Docker in the runner / container.
Fix: switch to --expose-token + helm registry login.
1. Without relying on Docker, hand the ACR login credentials to helm.
az acr login -n $ACR --expose-token --query accessToken -o tsv \ | helm registry login $ACR.azurecr.io -u 00000000-0000-0000-0000-000000000000 --password-stdin
2. Find the digest of 0.3.0 in helm/myapp and upgrade by digest.
D=$(az acr manifest list-metadata -r $ACR -n helm/myapp --query "[?tags[0]=='0.3.0'].digest" -o tsv) helm upgrade --install myapp oci://$ACR.azurecr.io/helm/myapp@$D -n myapp
The deployment pipeline reports helm 401, but Pods on the same cluster pull images normally, and someone suggests “run az aks update --attach-acr again”. Is that right?
No. Pods pulling images shows chain B (kubelet + attach-acr) is working; helm's 401 belongs to chain A: the pipeline identity has not logged in to ACR (or the token expired, the tenant is wrong, or AcrPull is missing). Add a --expose-token login step to the pipeline, and assign AcrPull (or Repository Reader) to the pipeline identity.
Verified teaching videos
Official docs
- Store Helm charts in Azure Container Registry
- Helm: Use OCI-based registries
- ACR: acr purge automatic cleanup
- ACR retention policy (untagged Docker manifests only)
- AKS and ACR integration (attach-acr)
Video storyboard (about 100 seconds)
Scene: in the ACR repository, two boxes side by side: “myapp image” and “helm/myapp chart”.
Narration: the same ACR can hold both images and charts; charts are stored as OCI artifacts.
Scene: a helm figure holds a “refresh token” and knocks on the ACR door; the door returns 401 and a map (WWW-Authenticate); the figure goes to /oauth2/token and exchanges it for a short-lived ticket for “read-only helm/myapp”.
Narration: helm first uses the refresh token to exchange for an access token that applies only to this repository and this action, then fetches the manifest and chart layers.
Scene: the picture splits in two; on the left the helm figure is rejected (401); on the right the kubelet on the node pulls the image successfully.
Narration: attach-acr only authorizes the kubelet. helm's 401 and a Pod's image pull failure are two different credential chains.
Scene: tags are like sticky notes that can be torn off and reattached; digests are like a stamp.
Narration: in production, install by digest; clean up old charts with acr purge, since the retention policy cannot reach OCI manifests.
Module 3 · Chart Design for Workload Identity and Key Vault
- Make the
azure.workload.identity/client-idannotations andazure.workload.identity/use: "true"Pod labels into values toggles, and userequired/failto give clear error messages. - Templatize the
SecretProviderClassKey Vault name, tenant, object list, and optional sync to a Kubernetes Secret; automatically roll the Pods when the configuration changes. - Understand the coupling between the federated credential subject
system:serviceaccount:<ns>:<sa>and the chart's named templates (fullname / serviceAccountName), to avoid AADSTS70021 when the release name changes.
What: what Azure-specific things the chart needs to render
| Object / field | Value | Who reads it |
|---|---|---|
ServiceAccount annotation azure.workload.identity/client-id | Client ID of the user-assigned managed identity (or Entra app) | WI mutating webhook (injects AZURE_CLIENT_ID) |
ServiceAccount annotation azure.workload.identity/tenant-id (optional) | Tenant ID; defaults to the cluster tenant in the webhook config | webhook |
Pod template label azure.workload.identity/use: "true" | must be the string "true", and must be set on the Pod template (set there) | the webhook only mutates Pods with this label: injects AZURE_CLIENT_ID,AZURE_TENANT_ID,AZURE_FEDERATED_TOKEN_FILE,AZURE_AUTHORITY_HOST and projected token volume |
Pod annotation (optional) azure.workload.identity/skip-containers,service-account-token-expiration | semicolon-separated container names; 3600–86400 seconds | webhook |
SecretProviderClass (secrets-store.csi.x-k8s.io/v1) | usePodIdentity: "false",clientID,keyvaultName,tenantId,objects | Secrets Store CSI driver + Azure provider (add-on) |
Pod volume csi.driver: secrets-store.csi.k8s.io | volumeAttributes.secretProviderClass | kubelet → CSI driver |
Why: why parameterize instead of hard-coding
- The same chart must be reused on kind (Lessons 1, 2, 5–7), AKS and EKS (Lesson 4 uses Pod Identity); Azure-specific objects must be switchable off as a whole.
- The client ID, Key Vault name and tenant differ in each environment, so they belong in environment values, not in chart defaults.
- Omitting or mistyping these fields does not fail at
helm installtime; instead it turns intoFailedMountor AADSTS errors when the Pod starts—so userequired/failin the template to move the error forward to the render stage.
How: values design
serviceAccount:
create: true
name: "" # when WI is enabled, set this explicitly to avoid changes with the release name
annotations: {}
azure:
workloadIdentity:
enabled: false
clientId: "" # the clientId of the user-assigned managed identity
tenantId: "" # optional
keyVault:
enabled: false # depends on workloadIdentity.enabled
name: ""
tenantId: "" # defaults to workloadIdentity.tenantId
mountPath: /mnt/secrets-store
objects: # Key Vault objects → mounted as files
- name: redis-password
type: secret # secret | key | cert
alias: "" # file name, defaults to the same as name
version: "" # defaults to the latest
syncSecret:
enabled: false # sync as a K8s Secret, for use via env secretKeyRef
secretName: "" # defaults to <fullname>-kv
Key design decisions
| Decision | Reason |
|---|---|
The WI annotation is merged into serviceAccount.annotations, rather than replacing it | Users may have other annotations (such as cross-cloud IRSA-style annotations or monitoring annotations) |
keyVault.enabled and workloadIdentity.enabled is false fail | This chart supports only the WI approach to access Key Vault; avoids falling back to the node managed identity (all Pods would share its permissions) |
Pre-render check .Capabilities.APIVersions.Has "secrets-store.csi.x-k8s.io/v1" | give a readable error when the add-on is not enabled, rather than no matches for kind "SecretProviderClass" |
Pod annotation checksum/kv | triggers a rollout when the SecretProviderClass changes (different objects, different versions); CSI only fetches on mount |
| NOTES.txt prints the federated credential subject | The subject must exactly match the actual SA name; print it so operators can verify |
When: file mount vs sync as a Secret
| Mount as file only | Sync as K8s Secret (secretObjects) | |
|---|---|---|
| Are secrets in etcd? | No (tmpfs) | Yes (protected by etcd encryption) |
| How the app reads it | reads the file (such as REDIS_PASSWORD_FILE), or Ingress TLS | env secretKeyRef Rotation (when the add-on has |
rotation --enable-secret-rotation enabled) | Files update automatically; the app must re-read them | Secret updates, but env needs a Pod restart |
| Note | — | the Secret is created only after at least one Pod mounts the volume |
Comparison with similar technologies
| Key Vault CSI (this module) | External Secrets Operator | helm-secrets / SOPS | |
|---|---|---|---|
| Where secrets are decrypted | CSI provider on the node | In-cluster controller → K8s Secret | At deploy time (helm client) |
| What is written in the chart | SecretProviderClass + volume | ExternalSecret CR | Encrypted values file |
| AKS-managed | Yes (add-on) | No (self-managed chart) | — |
| See | this module | M5 · Lesson 6 | Lesson 6 |
azure.workload.identity/use to the Deployment's metadata.labels —the webhook looks at Pods, so it must be on the spec.template.metadata.labels. ② Writing it as use: true (boolean)—label values must be strings, and validation fails outright. ③ Assuming an SA annotation change takes effect immediately—annotations are read by the webhook at Pod creation, so the Pod must be restarted. ④ Assuming --attach-acr or the kubelet identity can access Key Vault—WI uses the user-assigned managed identity you created yourself.Correspondence between chart objects and Azure resources
The most error-prone coupling: subject and SA name
Animation 1: token exchange when a Pod starts (CSI mounts Key Vault)
Pick a fault and step through it to see which hop the error appears at and what shows in the Pod events.
Animation 2: values toggle → rendered output preview
Template code (added to the Lesson 2 myapp chart)
{{- if .Values.serviceAccount.create }}
{{- $ann := deepCopy (.Values.serviceAccount.annotations | default dict) }}
{{- with .Values.azure.workloadIdentity }}
{{- if .enabled }}
{{- $_ := set $ann "azure.workload.identity/client-id" (required "azure.workloadIdentity.clientId is required when azure.workloadIdentity.enabled=true" .clientId) }}
{{- if .tenantId }}{{- $_ := set $ann "azure.workload.identity/tenant-id" .tenantId }}{{- end }}
{{- end }}
{{- end }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "myapp.serviceAccountName" . }}
labels:
{{- include "myapp.labels" . | nindent 4 }}
{{- with $ann }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- with .Values.azure.keyVault }}
{{- if .enabled }}
{{- if not $.Values.azure.workloadIdentity.enabled }}
{{- fail "azure.keyVault.enabled=true requires azure.workloadIdentity.enabled=true" }}
{{- end }}
{{- if not ($.Capabilities.APIVersions.Has "secrets-store.csi.x-k8s.io/v1") }}
{{- fail "SecretProviderClass CRD not found: enable the AKS add-on azure-keyvault-secrets-provider (or pass --api-versions secrets-store.csi.x-k8s.io/v1 to helm template)" }}
{{- end }}
apiVersion: secrets-store.csi.x-k8s.io/v1
kind: SecretProviderClass
metadata:
name: {{ include "myapp.fullname" $ }}-kv
labels:
{{- include "myapp.labels" $ | nindent 4 }}
spec:
provider: azure
parameters:
usePodIdentity: "false"
clientID: {{ $.Values.azure.workloadIdentity.clientId | quote }}
keyvaultName: {{ required "azure.keyVault.name is required" .name | quote }}
tenantId: {{ required "azure.keyVault.tenantId (or azure.workloadIdentity.tenantId) is required" (.tenantId | default $.Values.azure.workloadIdentity.tenantId) | quote }}
objects: |
array:
{{- range .objects }}
- |
objectName: {{ .name }}
objectType: {{ .type | default "secret" }}
{{- with .alias }}
objectAlias: {{ . }}
{{- end }}
objectVersion: {{ .version | default "" | quote }}
{{- end }}
{{- if .syncSecret.enabled }}
secretObjects:
- secretName: {{ .syncSecret.secretName | default (printf "%s-kv" (include "myapp.fullname" $)) }}
type: Opaque
data:
{{- range .objects }}
- objectName: {{ .alias | default .name }}
key: {{ .alias | default .name }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
template:
metadata:
labels:
{{- include "myapp.selectorLabels" . | nindent 8 }}
{{- if .Values.azure.workloadIdentity.enabled }}
azure.workload.identity/use: "true"
{{- end }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
{{- if .Values.azure.keyVault.enabled }}
checksum/kv: {{ include (print $.Template.BasePath "/secretproviderclass.yaml") . | sha256sum }}
{{- end }}
spec:
serviceAccountName: {{ include "myapp.serviceAccountName" . }}
containers:
- name: myapp
# …image / ports / probes from Lesson 2…
{{- if .Values.azure.keyVault.enabled }}
env:
- name: REDIS_PASSWORD_FILE
value: {{ .Values.azure.keyVault.mountPath }}/redis-password
volumeMounts:
- name: kv-secrets
mountPath: {{ .Values.azure.keyVault.mountPath }}
readOnly: true
{{- end }}
{{- if .Values.azure.keyVault.enabled }}
volumes:
- name: kv-secrets
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
secretProviderClass: {{ include "myapp.fullname" . }}-kv
{{- end }}
{{- if .Values.azure.workloadIdentity.enabled }}
Workload Identity: the federated credential subject MUST be
system:serviceaccount:{{ .Release.Namespace }}:{{ include "myapp.serviceAccountName" . }}
{{- end }}
Local render verification (kind or no cluster)
helm template t ./myapp --set azure.keyVault.enabled=true 2>&1 | tail -1 helm template t ./myapp --api-versions secrets-store.csi.x-k8s.io/v1 \ --set azure.workloadIdentity.enabled=true --set azure.workloadIdentity.clientId=00000000-1111-2222-3333-444444444444 \ --set azure.workloadIdentity.tenantId=72f988bf-0000-0000-0000-000000000000 \ --set azure.keyVault.enabled=true --set azure.keyVault.name=kv-demo \ --show-only templates/secretproviderclass.yaml
Error: execution error at (myapp/templates/secretproviderclass.yaml:4:4): azure.keyVault.enabled=true requires azure.workloadIdentity.enabled=true
---
# Source: myapp/templates/secretproviderclass.yaml
apiVersion: secrets-store.csi.x-k8s.io/v1
kind: SecretProviderClass
metadata:
name: t-myapp-kv
…
spec:
provider: azure
parameters:
usePodIdentity: "false"
clientID: "00000000-1111-2222-3333-444444444444"
keyvaultName: "kv-demo"
tenantId: "72f988bf-0000-0000-0000-000000000000"
objects: |
array:
- |
objectName: redis-password
objectType: secret
objectVersion: ""
Note:helm template By default it does not connect to a cluster, so it only has the built-in APIs; use .Capabilities.APIVersions to declare that the CRD exists. Also, in the --api-versions of the Lesson 2 chart, add values.schema.json for clientId add "format": "uuid" so that spelling errors are caught during lint.
Azure-side commands
| Command | Purpose |
|---|---|
az identity create -g $RG -n id-myapp | Create a user-assigned managed identity |
az aks show --query oidcIssuerProfile.issuerUrl -o tsv | Get the cluster OIDC issuer |
az identity federated-credential create --issuer … --subject system:serviceaccount:NS:SA --audiences api://AzureADTokenExchange | Establish trust (up to 20 federated credentials per identity) |
az role assignment create --role "Key Vault Secrets User" --scope <kv id> | Grant secret read permission (Key Vault in RBAC mode) |
az aks addon update --addon azure-keyvault-secrets-provider --enable-secret-rotation | Enable rotation (periodic file refresh) |
Lab 3: myapp reads the Redis password from Key Vault (about 8 min)
az identity create -g $RG -n id-myapp export CLIENT_ID=$(az identity show -g $RG -n id-myapp --query clientId -o tsv) export PRINCIPAL_ID=$(az identity show -g $RG -n id-myapp --query principalId -o tsv) export TENANT_ID=$(az account show --query tenantId -o tsv) export ISSUER=$(az aks show -g $RG -n $AKS --query oidcIssuerProfile.issuerUrl -o tsv) az identity federated-credential create -g $RG --identity-name id-myapp -n fc-myapp \ --issuer "$ISSUER" --subject system:serviceaccount:$NS:myapp --audiences api://AzureADTokenExchange az role assignment create --role "Key Vault Secrets User" \ --assignee-object-id $PRINCIPAL_ID --assignee-principal-type ServicePrincipal \ --scope $(az keyvault show -n $KV --query id -o tsv)
values-aks.yaml)
cat >> values-aks.yaml <<EOF
serviceAccount:
name: myapp
azure:
workloadIdentity:
enabled: true
clientId: "$CLIENT_ID"
tenantId: "$TENANT_ID"
keyVault:
enabled: true
name: "$KV"
objects:
- name: redis-password
EOFsed -i 's/^version:.*/version: 0.4.0/' myapp/Chart.yaml helm package myapp && helm push myapp-0.4.0.tgz oci://$ACR.azurecr.io/helm helm upgrade --install myapp oci://$ACR.azurecr.io/helm/myapp --version 0.4.0 \ -n $NS -f values-aks.yaml --wait --timeout 5m
Release "myapp" has been upgraded. Happy Helming! NAME: myapp STATUS: deployed REVISION: 3 NOTES: Workload Identity: the federated credential subject MUST be system:serviceaccount:myapp:myapp
POD=$(kubectl get pod -n $NS -l app.kubernetes.io/instance=myapp -o name | head -1)
kubectl get $POD -n $NS -o jsonpath='{range .spec.containers[0].env[*]}{.name}{"\n"}{end}'
kubectl exec -n $NS $POD -- ls /mnt/secrets-store
kubectl exec -n $NS $POD -- sh -c 'wc -c < /mnt/secrets-store/redis-password'
REDIS_PASSWORD_FILE AZURE_CLIENT_ID AZURE_TENANT_ID AZURE_FEDERATED_TOKEN_FILE AZURE_AUTHORITY_HOST redis-password 33
print only the length; do not print the cat secret in the terminal. If myapp only supports REDIS_PASSWORD environment variables, switch to syncSecret.enabled=true and in the Deployment use secretKeyRef to reference it myapp-kv.
helm upgrade … --set serviceAccount.name=myapp2, observe the Pod stuck in ContainerCreating,kubectl describe pod and see the event AADSTS70021 appear; change back to myapp to recover.Case 1: during a blue-green release, every Pod in the second release hits FailedMount
Problem: The team used two myapp-blue / myapp-green releases for blue-green; all of green's Pods FailedMount … AADSTS70021. Root cause: the SA name comes from fullname, and green's SA is myapp-green, but the federated credential only registered blue's subject. Fix: Create one federated credential per SA (the same identity can have up to 20), or let both releases share an explicitly named SA (serviceAccount.create=false pre-created by the platform). Limitation: A federated credential takes a few seconds to propagate after creation, so create the credential before deploying in the release script.
Case 2: after secret rotation, the app still uses the old password
Problem: The Redis password was rotated in Key Vault and the mounted file updated, but the app's connection fails. Root cause: the app reads the file once at startup and caches it; the synced K8s Secret is used as an env var, and env does not hot-reload. Fix: change the app to re-read the file when a connection fails; or run kubectl rollout restart as the last step of the rotation process; provide podAnnotations.rotatedAt in the chart for the pipeline to write a timestamp and trigger a rollout. Limitation: The add-on's rotation is polling (default 2 minutes), not event-driven.
Case 3: the same chart delivered to the AWS team
Problem: The AWS team wants to use the same chart, but the SecretProviderClass hard-codes provider: azure. Fix: Put the cloud-related objects under azure.* / aws.* two mutually exclusive switch groups (validation fails if both are on: fail); Lesson 4 adds aws.podIdentity and the ASCP provider for EKS. Limitation: Don't build a “universal abstraction layer”; each cloud's field semantics differ, so explicit grouping is easier to maintain.
Common errors and fixes
MountVolume.SetUp failed for volume "kv-secrets" : rpc error: code = Unknown desc = failed to mount secrets store objects for pod myapp/myapp-…, err: … AADSTS70021: No matching federated identity record found for presented assertion.
Cause: The token's issuer or subject does not match the federated credential: the SA name or namespace changed, the issuer URL is missing its trailing slash, or it comes from another cluster.
kubectl get pod POD -n myapp -o jsonpath='{.spec.serviceAccountName}{"\n"}'
az identity federated-credential list -g $RG --identity-name id-myapp --query "[].{subject:subject,issuer:issuer}" -o table
az aks show -g $RG -n $AKS --query oidcIssuerProfile.issuerUrl -o tsv… AADSTS700016: Application with identifier '…' was not found in the directory '…'
Cause:clientID The client ID in the (SPC) or SA annotation is wrong, or the identity's principalId (object ID) was used instead of clientId, or the tenant ID is wrong.
Fix:az identity show -g $RG -n id-myapp --query "{clientId:clientId, principalId:principalId}", and confirm values uses clientId.
… keyvault.BaseClient#GetSecret: Failure responding to request: StatusCode=403 … Caller is not authorized to perform action on resource … Action: 'Microsoft.KeyVault/vaults/secrets/getSecret/action'
Cause: Token exchange succeeded, but the identity has no Key Vault data-plane permission (RBAC mode needs Key Vault Secrets User; access-policy mode needs the get secret policy), or the role assignment has not yet propagated.
az role assignment list --assignee $PRINCIPAL_ID --scope $(az keyvault show -n $KV --query id -o tsv) -o table
Error: INSTALLATION FAILED: unable to build kubernetes objects from release manifest: resource mapping not found for name: "myapp-kv" … no matches for kind "SecretProviderClass" in version "secrets-store.csi.x-k8s.io/v1"
Cause: The cluster does not have the Key Vault add-on enabled (the CRD does not exist). The Capabilities check in this module turns it into a clearer fail message.
Fix:az aks enable-addons -a azure-keyvault-secrets-provider -g $RG -n $AKS; do not install a second Secrets Store CSI with Helm (see M5).
Deployment.apps "myapp" is invalid: spec.template.metadata.labels: Invalid value: … (or json: cannot unmarshal bool into Go struct field ObjectMeta.spec.template.metadata.labels of type string)
Cause: the label was written as azure.workload.identity/use: true (boolean).
Fix: in the template, write "true" (quoted).
1. Render the SecretProviderClass without connecting to a cluster, and declare that the CRD exists.
helm template t ./myapp -f values-aks.yaml --api-versions secrets-store.csi.x-k8s.io/v1 --show-only templates/secretproviderclass.yaml
2. List all federated credential subjects of id-myapp and compare them with the current Pod's SA.
az identity federated-credential list -g $RG --identity-name id-myapp --query "[].subject" -o tsv
kubectl get pod -n myapp -l app.kubernetes.io/instance=myapp -o jsonpath='{.items[0].spec.serviceAccountName}'The platform team wants: “no business chart may create its own ServiceAccount; the WI identity is managed centrally by the platform.” How should the chart be designed?
The chart provides serviceAccount.create=false + serviceAccount.name (required; use required), and only adds azure.workload.identity/use label and the clientID; the platform pre-creates the SA (with annotations), the managed identity and the federated credential with IaC. The chart's NOTES.txt still prints the expected subject for verification.
Verified teaching videos
Official docs
- Use Microsoft Entra Workload ID on AKS (annotations, labels, limitations)
- Access Azure Key Vault with the CSI Driver Identity Provider
- CSI Secrets Store configuration options (rotation, syncing Secrets)
- Helm: required / fail functions
Video storyboard (about 100 seconds)
Scene: two switches in values.yaml, workloadIdentity / keyVault, flip from off to on; on the right, the ServiceAccount annotation and SecretProviderClass are rendered.
Narration: the same chart runs on kind with the Azure switches off; on AKS, turning on the two switches reads Key Vault without keys.
Scene: a Pod is born and the webhook attaches environment variables; the CSI driver takes the SA token to Entra to exchange for a ticket, then goes to Key Vault to fetch redis-password and place it in tmpfs.
Narration: when mounting the volume, the CSI driver uses the Pod's service account token to exchange for an access token with Entra, then reads the secret from Key Vault and writes it as a file.
Scene: the release name changes from myapp to shop-api; the SA name changes with it, the federated credential subject no longer matches, and a red AADSTS70021 pops up.
Narration: the federated credential subject must exactly match the service account name. When enabling workload identity, set the service account name explicitly.
Scene: helm template directly reports a readable fail message.
Narration: use required and fail to move cloud runtime errors forward to the render stage.
Module 4 · Ingress / Gateway: application routing and entry chart
- Accurately describe the current state of the AKS application routing add-on: managed NGINX based on the Ingress API, and the
approuting-istioimplementation based on the Gateway API, Managed Gateway API CRDs, and AKS Automatic's default behavior. - In the myapp chart, use a
ingress.mode(none/ingress/gateway) switch to optionally render an Ingress or HTTPRoute (and an optional Gateway), and use Capabilities to check the CRDs. - Check the Gateway / HTTPRoute status conditions (Accepted, ResolvedRefs, Programmed) to find out why the entry is not taking effect.
What: the two implementations of the AKS application routing add-on (verified 2026-11)
| Managed NGINX (Ingress API) | Gateway API implementation (approuting-istio) | |
|---|---|---|
| Resource | Ingress,ingressClassName: webapprouting.kubernetes.azure.com | Gateway (gatewayClassName: approuting-istio) + HTTPRoute |
| enabled | az aks approuting enable | az aks update --enable-gateway-api --enable-app-routing-istio (requires CLI ≥ 2.86 and Managed Gateway API CRDs enabled) |
| Support status | Official: no Azure support after November 2026, so migration must happen before then | GA (AKS blog 2026-06-10); AKS Automatic 1.36+ new clusters enable it by default |
| Data plane | NGINX | Istio control plane (istiod in aks-istio-system ) creates for each Gateway an Envoy Deployment + LoadBalancer Service + HPA (minimum 2) + PDB |
| Limitations | — | No sidecar injection or Istio CRDs; no EnvoyFilter (so no request body size limit, rate limiting, or Lua); cannot be enabled together with the Istio service mesh add-on; does not manage outbound traffic |
| CRD source | Built-in Ingress API | Managed Gateway API installation (AKS manages the CRDs); self-managed Gateway API CRDs are not supported |
The Deployment / Service name of a Gateway is <gateway name>-approuting-istio, which can be overridden with the annotation gateway.istio.io/name-override ; Envoy access logs are enabled by default (kubectl logs deploy/<gw>-approuting-istio). The Istio control plane is upgraded in place with the AKS version; traffic may briefly be disturbed during upgrades, so the default HPA min 2 + PDB matters.
Why: why the chart should support both entry types
- Existing clusters still use Ingress (managed NGINX, AGIC, or another controller), while new clusters use the Gateway API; the same chart must serve both kinds of cluster and support per-environment migration.
- A Gateway is usually owned by the platform team (shared LB and certificates); a business chart should only create
HTTPRoutethat attaches to an existing Gateway; only for “dedicated entry” cases should the chart build its own Gateway.
How: values design
ingress:
mode: none # none | ingress | gateway
host: myapp.example.com
path: /
# mode=ingress
className: "" # e.g. webapprouting.kubernetes.azure.com (managed NGINX, support ending soon)
annotations: {}
tls: [] # [{secretName: myapp-tls, hosts: [myapp.example.com]}]
# mode=gateway
gateway:
create: false # true: the chart creates its own Gateway (dedicated entry)
className: approuting-istio
name: "" # when create=false, references the platform's Gateway
namespace: "" # namespace where the platform Gateway lives
sectionName: "" # attach to a specific listener (such as https)
listeners: # used when create=true
- name: http
port: 80
protocol: HTTP
Division of responsibilities between the platform Gateway and business HTTPRoute
| Object | Owned by | Namespace | Key fields |
|---|---|---|---|
GatewayClass approuting-istio | AKS (add-on) | cluster level | — |
| Gateway | Platform team (IaC or platform chart) | gateway-system | listeners[].allowedRoutes.namespaces.from: Selector controls which namespaces may attach |
| HTTPRoute | Business chart | myapp | parentRefs (name / namespace / sectionName),hostnames,backendRefs |
| TLS certificates | Platform (Key Vault certificates synced as a Secret via CSI, or cert-manager) | the namespace where the Gateway lives | listeners[].tls.certificateRefs |
When: which mode to choose
- New AKS clusters:
mode=gateway,gateway.create=falseattach to the platform Gateway. - Migration period: in the old environment, the same chart uses
mode=ingress, and new environments usemode=gateway; the official docs have a guide for migrating from NGINX to the Gateway API, NGINX annotations must be replaced one by one (some only via the Istio add-on + EnvoyFilter). - Local kind:
mode=noneuse port-forward, or after installing Envoy Gateway per the K8s course,mode=gateway.
Comparison with similar technologies
| App Routing Gateway API | Istio service mesh add-on (Gateway API) | Application Gateway for Containers | |
|---|---|---|---|
| GatewayClass | approuting-istio | istio | azure-alb-external |
| Data plane location | In-cluster Envoy | In-cluster Envoy (sidecar / ambient possible) | Azure-managed (outside the cluster) |
| Upgrades | In place (with AKS) | Canary upgrade by revision (minor) | Azure-managed |
| Best for | Default entry | Needs a mesh or EnvoyFilter | Needs WAF / L7 outside the cluster |
kubectl apply a set of Gateway API CRDs yourself is enough”—the application routing Gateway API implementation only supports Managed Gateway API CRDs. ③ “A successfully created HTTPRoute means it works”—you must check status.parents[].conditions; when Accepted=False, traffic does not get in. ④ “Ingress nginx.ingress.kubernetes.io/* annotations can be copied over to HTTPRoute”—the Gateway API has no annotation convention; use standard fields (filters, timeouts, etc.) or implementation-specific policies.Request path: two modes
Three conditions for an HTTPRoute to take effect
Interactive: entry-mode renderer
Switch values; the right side shows in real time the objects the chart renders, plus the status and potential issues to check after deploying on AKS.
Template code
{{- if eq .Values.ingress.mode "gateway" }}
{{- if not (.Capabilities.APIVersions.Has "gateway.networking.k8s.io/v1/HTTPRoute") }}
{{- fail "ingress.mode=gateway but Gateway API CRDs are missing (AKS: az aks update --enable-gateway-api)" }}
{{- end }}
{{- $gw := .Values.ingress.gateway }}
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: {{ include "myapp.fullname" . }}
labels:
{{- include "myapp.labels" . | nindent 4 }}
spec:
parentRefs:
- name: {{ if $gw.create }}{{ include "myapp.fullname" . }}{{ else }}{{ required "ingress.gateway.name is required when gateway.create=false" $gw.name }}{{ end }}
{{- if and (not $gw.create) $gw.namespace }}
namespace: {{ $gw.namespace }}
{{- end }}
{{- with $gw.sectionName }}
sectionName: {{ . }}
{{- end }}
hostnames:
- {{ .Values.ingress.host | quote }}
rules:
- matches:
- path:
type: PathPrefix
value: {{ .Values.ingress.path }}
backendRefs:
- name: {{ include "myapp.fullname" . }}
port: {{ .Values.service.port }}
{{- end }}
{{- if and (eq .Values.ingress.mode "gateway") .Values.ingress.gateway.create }}
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: {{ include "myapp.fullname" . }}
labels:
{{- include "myapp.labels" . | nindent 4 }}
spec:
gatewayClassName: {{ .Values.ingress.gateway.className }}
listeners:
{{- range .Values.ingress.gateway.listeners }}
- name: {{ .name }}
port: {{ .port }}
protocol: {{ .protocol }}
hostname: {{ $.Values.ingress.host | quote }}
allowedRoutes:
namespaces:
from: Same
{{- with .tls }}
tls:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}
{{- if eq .Values.ingress.mode "ingress" }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "myapp.fullname" . }}
labels:
{{- include "myapp.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- with .Values.ingress.className }}
ingressClassName: {{ . }}
{{- end }}
{{- with .Values.ingress.tls }}
tls:
{{- toYaml . | nindent 4 }}
{{- end }}
rules:
- host: {{ .Values.ingress.host | quote }}
http:
paths:
- path: {{ .Values.ingress.path }}
pathType: Prefix
backend:
service:
name: {{ include "myapp.fullname" . }}
port:
number: {{ .Values.service.port }}
{{- end }}
In the values.schema.json file, define ingress.mode as "enum": ["none","ingress","gateway"], so spelling errors are caught at lint time (Lesson 2 Module 5). .Capabilities.APIVersions.Has supports group/version/Kind form, so a specific Kind can be checked precisely.
Common check commands
| Command | Purpose |
|---|---|
kubectl get gatewayclass | confirm approuting-istio ACCEPTED=True |
kubectl get gateway -A | ADDRESS and PROGRAMMED columns |
kubectl get httproute -n myapp -o yaml | yq '.items[].status.parents' | Accepted / ResolvedRefs conditions and reason |
kubectl logs -n NS deploy/<gw>-approuting-istio | Envoy access logs (enabled by default) |
kubectl get pods -n aks-istio-system | whether istiod is healthy |
helm template … --api-versions gateway.networking.k8s.io/v1/HTTPRoute | declare the CRD exists when rendering offline |
Lab 4: render an HTTPRoute for myapp and access it through approuting-istio (about 7 min)
kubectl create namespace gateway-system
kubectl label namespace $NS gateway-access=true
kubectl apply -f - <<'EOF'
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: shared
namespace: gateway-system
spec:
gatewayClassName: approuting-istio
listeners:
- name: http
port: 80
protocol: HTTP
allowedRoutes:
namespaces:
from: Selector
selector:
matchLabels:
gateway-access: "true"
EOF
kubectl wait --for=condition=programmed gateway/shared -n gateway-system --timeout=5m
kubectl get gateway -n gateway-system
gateway.gateway.networking.k8s.io/shared condition met NAME CLASS ADDRESS PROGRAMMED AGE shared approuting-istio 20.151.88.123 True 2m
cat >> values-aks.yaml <<'EOF'
ingress:
mode: gateway
host: myapp.example.com
gateway:
name: shared
namespace: gateway-system
EOF
sed -i 's/^version:.*/version: 0.5.0/' myapp/Chart.yaml
helm package myapp && helm push myapp-0.5.0.tgz oci://$ACR.azurecr.io/helm
helm upgrade myapp oci://$ACR.azurecr.io/helm/myapp --version 0.5.0 -n $NS -f values-aks.yaml --waitkubectl get httproute -n $NS -o jsonpath='{range .items[0].status.parents[0].conditions[*]}{.type}={.status} ({.reason}){"\n"}{end}'
IP=$(kubectl get gateway shared -n gateway-system -o jsonpath='{.status.addresses[0].value}')
curl -s -H "Host: myapp.example.com" http://$IP/healthz
Accepted=True (Accepted)
ResolvedRefs=True (ResolvedRefs)
{"status":"ok"}kubectl label namespace $NS gateway-access-
kubectl get httproute -n $NS -o jsonpath='{.items[0].status.parents[0].conditions[0]}{"\n"}'
kubectl label namespace $NS gateway-access=true
{"lastTransitionTime":"…","message":"…","reason":"NotAllowedByListeners","status":"False","type":"Accepted"}helm template t ./myapp -f values-aks.yaml --set ingress.mode=ingress --set ingress.className=webapprouting.kubernetes.azure.com --show-only templates/ingress.yaml—render only, do not deploy; managed NGINX is not enabled on this cluster.Case 1: migrating from managed NGINX to the Gateway API
Problem: 40 business charts all render ingressClassName: webapprouting.kubernetes.azure.com Ingress objects, and they must migrate before 2026-11. Fix: First add ingress.mode and an HTTPRoute template to the shared library chart (backward compatible; default ingress); the platform enables --enable-gateway-api --enable-app-routing-istio and creates the shared Gateway; switch values to gateway environment by environment; switch DNS to the new Gateway IP; finally turn off NGINX. Limitation:proxy-body-size, rate limiting and other NGINX annotations have no equivalent in approuting-istio; these few services use the Istio add-on's Gateway + EnvoyFilter instead (canary upgrades must be done manually).
Case 2: occasional 503 errors during Gateway upgrades
Problem: The AKS upgrade triggered an in-place Istio minor upgrade, and monitoring showed a small number of 503s. Fix: Keep the add-on's default HPA (min 2) and PDB; raise the Gateway replica min to 3; set retries on the business HTTPRoute (where the implementation supports it). Limitation: The istiod HPA's minReplicas must not be set below 2.
Case 3: business charts each creating their own Gateway led to 30 public IPs
Problem: Every team gateway.create=true, and each Gateway has one LoadBalancer Service and public IP, so costs and the security surface got out of control. Fix: the library chart defaults to create=false, and the platform uses Azure Policy / ValidatingAdmissionPolicy to forbid business namespaces from creating Gateways; the shared Gateway uses allowedRoutes.namespaces.from: Selector to control access. Limitation: Changes to the shared Gateway have a wide blast radius and need a platform change process.
Common errors and fixes
HTTPRoute status: Accepted=False reason=NotAllowedByListeners
Cause: the Gateway listener's allowedRoutes does not allow that namespace (from: Same or the label selector does not match), or sectionName points to a listener that does not exist.
kubectl get gateway shared -n gateway-system -o jsonpath='{.spec.listeners[*].allowedRoutes}'
kubectl get ns myapp --show-labelsHTTPRoute status: ResolvedRefs=False reason=BackendNotFound
Cause: the Service name or port in backendRefs does not match the Service the chart renders (for example, the name changed after fullnameOverride).
kubectl get svc -n myapp helm get manifest myapp -n myapp | grep -A12 'kind: HTTPRoute'
curl returns 404 / “route not found”, but both conditions are True
Cause: the requested Host header does not match hostnames (curling the IP directly without a Host header), or the path does not match.
Fix:curl -H "Host: myapp.example.com" http://IP/; check the Envoy access logs to confirm the request arrives.
Gateway PROGRAMMED=False, ADDRESS empty
Cause: the LoadBalancer Service has not been assigned an IP (quota, subnet or policy restriction), or istiod is not running (conflicts with the Istio service mesh add-on, leftover Istio CRDs).
kubectl get svc -n gateway-system kubectl get pods -n aks-istio-system kubectl get crd | grep istio.io
Error: … no matches for kind "HTTPRoute" in version "gateway.networking.k8s.io/v1"
Cause: Managed Gateway API is not enabled on the cluster (the CRD does not exist). The Capabilities check in this module's template gives a readable message in advance.
Fix:az aks update -g $RG -n $AKS --enable-gateway-api; do not apply upstream CRDs yourself.
1. Render an HTTPRoute without connecting to a cluster (declare that the CRD exists).
helm template t ./myapp --set ingress.mode=gateway --set ingress.gateway.name=shared \ --api-versions gateway.networking.k8s.io/v1/HTTPRoute --show-only templates/httproute.yaml
2. One command to print the conditions of all HTTPRoutes in the myapp namespace.
kubectl get httproute -n myapp -o jsonpath='{range .items[*]}{.metadata.name}{": "}{range .status.parents[*].conditions[*]}{.type}={.status}/{.reason} {end}{"\n"}{end}'A service depends on the NGINX annotation proxy-body-size: 50m for large file uploads, and the team wants to migrate to approuting-istio. What would you advise?
approuting-istio does not support EnvoyFilter, so there is no way to configure a request body size limit. Options: ① assess whether gateway-level limits are really needed (the application can enforce them itself); ② move that service to the Istio service mesh add-on's Gateway API entry (GatewayClass istio) and use a gateway-level EnvoyFilter (note: EnvoyFilter issues are outside Azure support scope, minor upgrades need a canary you run yourself, and the two implementations cannot be enabled at the same time); ③ use Application Gateway for Containers. In the chart, you only need to switch gateway.className / parentRefs.
Verified teaching videos
No verified video specifically covering the AKS application routing Gateway API implementation (approuting-istio) was found; use the official docs and the storyboard below.
Official docs
- AKS application routing add-on and Kubernetes Gateway API
- Secure ingress traffic with the application routing Gateway API implementation
- Migrating from managed NGINX to the Gateway API
- Managed Gateway API installation
- Gateway API official site
Video storyboard (about 90 seconds)
Scene: a timeline, with “approuting-istio GA” written at 2026-06, and the NGINX icon turning gray at 2026-11.
Narration: the AKS application routing add-on has two implementations. The Ingress-based managed NGINX stops being supported after November 2026; the Gateway API-based implementation is now officially released.
Scene: in values.yaml, ingress.mode switches from ingress to gateway; on the right, the objects change from Ingress to HTTPRoute.
Narration: the chart uses one mode switch to move between Ingress and HTTPRoute, migrating one environment at a time.
Scene: the platform team owns one shared Gateway; HTTPRoutes from several business namespaces attach to it; an unlabeled namespace is rejected.
Narration: the Gateway belongs to the platform, the HTTPRoute belongs to the business. allowedRoutes decides who can attach.
Scene: three green lights: Programmed, Accepted, ResolvedRefs.
Narration: traffic reaches your app only when all three conditions are true.
Module 5 · Common Azure-Related Charts and Add-ons
- Know the three sources of common platform components on AKS: add-ons,cluster extensions,self-managed Helm charts, and the currently recommended source for each component (as of 2026-11).
- Explain the concrete consequences of duplicate installs: external metrics APIService overridden, CSI driver with two DaemonSets, duplicate webhook mutations, CRD version downgrades.
- Be able to install self-managed platform charts correctly with Helm (cert-manager, External Secrets): separate namespace, pinned version, CRD handling, Workload Identity integration.
What: component source comparison table (2026-11)
| Component | Upstream latest (verified) | AKS managed approach | Recommended | Consequence of duplicate install |
|---|---|---|---|---|
| Secrets Store CSI Driver + Azure provider | driver v1.6.2 (2026-11-05) · provider v1.8.2 (2026-06-11) | add-on azure-keyvault-secrets-provider | use the add-on | two DaemonSets register the same-named CSI driver secrets-store.csi.k8s.io, CRD version conflict |
| Azure Workload Identity webhook | v1.6.3 (2026-08-31) | --enable-workload-identity | use AKS built-in | two mutating webhooks inject at once; duplicate env vars / volumes make Pod creation fail |
| KEDA | v2.21.1 (2026-11-15) | add-on --enable-keda (AKS 1.37 corresponds to KEDA 2.20.x); pre-installed on AKS Automatic | use the add-on by default; when you need a newer version or custom values, disable the add-on first and then self-manage | Official: a cluster can have only one external metrics server; multiple KEDA installs are not supported; the APIService v1beta1.external.metrics.k8s.io is overridden by the later installer |
| Gateway / entry | — | Application routing (approuting-istio GA; managed NGINX stopping support soon), Istio add-on, AGC | use application routing Gateway API | self-managed Gateway API CRDs conflict with Managed CRDs (not supported) |
| cert-manager | v1.21.3 (2026-10-23) | none add-on | self-managed Helm chart (when ACME / an internal CA is needed) | — (watch out for duplicates with the cert-manager dependency embedded in other charts) |
| External Secrets Operator | v2.15.0 (2026-11-10, chart 2.15.0) | none add-on | self-manage when you need to sync Key Vault into a K8s Secret without mounting a volume | managing the same Secret with both CSI sync and ESO will overwrite each other |
| Monitoring | kube-prometheus-stack 93.3.0 | add-on monitoring (Container insights + managed Prometheus) | choose one, to avoid duplicate collection and duplicate costs | two node-exporter / kube-state-metrics sets, doubling resources and costs |
| Node scaling | Karpenter / cluster-autoscaler | NAP (based on Karpenter), built-in CA | use AKS built-in | self-managed Karpenter / CA competes with the built-in components for node pools |
| Flux / Dapr | Flux v2.10.0 | cluster extension (az k8s-extension) | choose one | two helm-controllers reconcile the same HelmRelease |
Version numbers come from each project's GitHub Releases (checked 2026-11-15). Add-ons follow the AKS minor version and get only patch upgrades within the same minor—so AKS 1.37's KEDA add-on is not the upstream latest.
Why: why “use the add-on whenever one is available”
- Azure support covers add-ons, not self-managed open-source components; CVE patches ship with AKS releases.
- Add-ons are compatibility-tested with AKS upgrades; self-managed charts require you to run your own upgrade matrix.
- Cost: low customizability (for example, the KEDA add-on does not let you change the Helm values of Metrics Server / Operator), and version lag.
How: rules for self-managed platform charts
- Separate release, separate namespace:
cert-manager,external-secretsdo not make it a subchart of a business chart (uninstalling the business would also delete the CRDs and controllers). - Pin the version:
--versionis required; in production, mirror the upstream chart to your own ACR (helm pull+helm push), and have the pipeline install only from ACR. - CRD policy: cert-manager uses
crds.enabled=trueso the chart manages CRDs (andcrds.keep=trueto prevent accidental deletion); Helm'scrds/directory installs but never upgrades (covered in detail in Lesson 6). - Identity: when access to Azure is needed (cert-manager's Azure DNS DNS-01, ESO reading Key Vault), also use Workload Identity: SA annotation + Pod label, passed in through chart values.
When: should Key Vault secrets use CSI or ESO?
| Key Vault CSI (add-on) | External Secrets Operator | |
|---|---|---|
| Where the secret lands | tmpfs file in the Pod (optional Secret sync) | K8s Secret |
| Needs a volume | yes (a Pod gets it only if it mounts the volume) | no |
| Identity granularity | each workload's own WI | at SecretStore level (one SA per namespace is possible) |
| Supported | Azure support | community |
| Typical use | the app reads the secret | Ingress TLS, or third-party charts that accept only a Secret name |
Comparison with similar technologies
| Add-on | Cluster extension | Self-managed Helm | |
|---|---|---|---|
| Where declared | AKS resource property | separate ARM resource | pipeline / Git |
| IaC | Bicep/Terraform cluster resource | Bicep/Terraform extension resource | helm_release / Helmfile / GitOps |
| Upgrades | with AKS | can auto-upgrade minor | by you |
The “owner” zones in the cluster
Why duplicate KEDA installs break
Interactive: “install or not” conflict checker
In the left column, tick the AKS add-ons / extensions already enabled on the cluster, and in the right column tick the chart you plan to helm install , then click “Check”.
Check and install commands
| Command | Purpose |
|---|---|
az aks show --query "{kv:addonProfiles.azureKeyvaultSecretsProvider.enabled, keda:workloadAutoScalerProfile.keda.enabled, wi:securityProfile.workloadIdentity.enabled, mon:addonProfiles.omsagent.enabled}" | See the common add-ons at a glance |
kubectl get apiservice v1beta1.external.metrics.k8s.io -o jsonpath='{.spec.service}' | who provides external metrics |
kubectl get csidrivers | CSI driver registration status |
kubectl get mutatingwebhookconfigurations | whether there are duplicate WI webhooks |
az aks update --enable-keda / --disable-keda | toggle the KEDA add-on |
helm show values oci://quay.io/jetstack/charts/cert-manager --version v1.21.3 | look at values before installing |
cert-manager (self-managed, OCI chart)
helm upgrade --install cert-manager oci://quay.io/jetstack/charts/cert-manager \ --version v1.21.3 -n cert-manager --create-namespace \ --set crds.enabled=true --set crds.keep=true \ --wait --rollback-on-failure --timeout 10m kubectl get pods -n cert-manager
Pulled: quay.io/jetstack/charts/cert-manager:v1.21.3 Digest: sha256:… Release "cert-manager" does not exist. Installing it now. NAME: cert-manager STATUS: deployed NAME READY STATUS RESTARTS AGE cert-manager-7c9f8b6d4-8x2lq 1/1 Running 0 60s cert-manager-cainjector-5b6c9d7f8-kq2mn 1/1 Running 0 60s cert-manager-webhook-6f7d8c9b5-zt4wp 1/1 Running 0 60s
If cert-manager needs Azure DNS for DNS-01, follow its docs: add the WI annotation and Pod label to the controller's SA (the serviceAccount.annotations and podLabels keys in chart values), and assign DNS Zone Contributor to the managed identity. Confirm the exact values key names in the cert-manager official docs.
External Secrets Operator + Key Vault (Workload Identity)
helm repo add external-secrets https://charts.external-secrets.io helm upgrade --install external-secrets external-secrets/external-secrets \ --version 2.15.0 -n external-secrets --create-namespace --wait
apiVersion: external-secrets.io/v1
kind: SecretStore
metadata:
name: kv
namespace: myapp
spec:
provider:
azurekv:
authType: WorkloadIdentity
vaultUrl: "https://kv-helm-lab-xxxx.vault.azure.net"
serviceAccountRef:
name: myapp # SA with the client-id annotation; a federated credential must be created for its subject
---
apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
name: redis
namespace: myapp
spec:
refreshInterval: 1h
secretStoreRef: { kind: SecretStore, name: kv }
target: { name: redis-from-eso }
data:
- secretKey: password
remoteRef: { key: redis-password }
ESO's serviceAccountRef authentication method has the ESO controller request tokens on behalf of this SA; the federated credential subject is the business SA (system:serviceaccount:myapp:myapp), the API version external-secrets.io/v1 and fields follow the ESO 2.x docs.
Mirror the upstream chart to your own ACR (recommended for production)
helm pull oci://quay.io/jetstack/charts/cert-manager --version v1.21.3 helm push cert-manager-v1.21.3.tgz oci://$ACR.azurecr.io/mirror # or import through ACR (without going through the local machine): az acr import -n $ACR --source quay.io/jetstack/charts/cert-manager:v1.21.3 --image mirror/cert-manager:v1.21.3
Lab 5: check the cluster components, and (optionally) install cert-manager (about 6 min)
az aks show -g $RG -n $AKS --query "{kv:addonProfiles.azureKeyvaultSecretsProvider.enabled, keda:workloadAutoScalerProfile.keda.enabled, wi:securityProfile.workloadIdentity.enabled}" -o table
kubectl get csidrivers
kubectl get mutatingwebhookconfigurations | grep -i -E 'workload|identity'
Kv Keda Wi ---- ------ ---- True True NAME ATTACHREQUIRED PODINFOONMOUNT … disk.csi.azure.com true false file.csi.azure.com false true secrets-store.csi.k8s.io false true azure-wi-webhook-mutating-webhook-configuration 1 40m
az aks update -g $RG -n $AKS --enable-keda
kubectl get pods -n kube-system | grep keda
kubectl get apiservice v1beta1.external.metrics.k8s.io -o jsonpath='{.spec.service}{"\n"}'
{{- if and .Values.keda.enabled (.Capabilities.APIVersions.Has "keda.sh/v1alpha1/ScaledObject") }}
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: {{ include "myapp.fullname" . }}
spec:
scaleTargetRef:
name: {{ include "myapp.fullname" . }}
minReplicaCount: {{ .Values.keda.minReplicas }}
maxReplicaCount: {{ .Values.keda.maxReplicas }}
triggers:
- type: cpu
metricType: Utilization
metadata:
value: "70"
{{- end }}
Note: when ScaledObject is enabled, the chart must not also render an HPA (official guidance: do not use both HPA and ScaledObject on the same workload). Use {{- if not .Values.keda.enabled }} to wrap the original hpa.yaml.
helm repo add kedacore https://kedacore.github.io/charts helm install keda kedacore/keda -n keda --create-namespace --dry-run=server 2>&1 | tail -5
A server-side dry-run may directly report CRD / APIService ownership conflicts (Helm 4 SSA); even if it doesn't error, do not actually install—this is exactly the “multiple KEDA not supported” case in the official docs.
helm list -A you should see only myapp and cert-manager two releases.az aks update -g $RG -n $AKS --disable-keda; when cert-manager is not needed helm uninstall cert-manager -n cert-manager (crds.keep=true — the release keeps the CRDs; delete them manually when needed).Case 1: the add-on KEDA version is behind, and a new scaler is needed
Problem: The team needs KEDA 2.21's new scaler, while AKS 1.37's add-on is 2.20.x. Fix: Evaluate waiting for the next AKS minor; if self-managing is needed, within the maintenance window --disable-keda, confirm that kube-system KEDA resources are removed from the AKS add-on state, then install upstream KEDA with Helm (pin the version, mirror the image to ACR, enable WI); ScaledObject resources are unaffected. Limitation: Loses Azure support; before future AKS upgrades you must validate KEDA compatibility yourself.
Case 2: the business chart pulled in a cert-manager subchart
Problem: A vendor chart's dependencies include cert-manager; after installation it competes with the platform's cert-manager for CRDs and webhooks, and certificate issuance intermittently fails. Fix: disable the subchart in values (the cert-manager.enabled=false dependency's condition field); the platform layer manages cert-manager centrally. Limitation: If the vendor chart does not provide a condition, you can only fork it or delete the resource with a post-renderer (Lesson 6).
Case 3: CSI-synced Secret and ESO overwrite each other
Problem: The same myapp-tls Secret is both the SPC's secretObjects target and an ExternalSecret's target, so the certificate is sometimes new and sometimes old. Fix: A Secret can have only one writer; TLS certificates are synced by ESO centrally into the Gateway namespace, and app secrets go through CSI files. Limitation: During migration, watch the Secret's ownerReferences and deletion policy.
Common errors and fixes
unable to get external metric myapp/s0-cpu/&LabelSelector{…}: … the server could not find the requested resource (get s0-cpu.external.metrics.k8s.io)
Cause: The external metrics APIService points to another KEDA, or the KEDA metrics apiserver is unhealthy.
kubectl get apiservice v1beta1.external.metrics.k8s.io -o yaml | grep -A3 -E 'service:|conditions' kubectl get pods -A | grep -i keda
Fix: Keep only one KEDA.
Error: INSTALLATION FAILED: … CustomResourceDefinition "secretproviderclasses.secrets-store.csi.x-k8s.io" … exists and cannot be imported into the current release
Cause: An attempt to install Secrets Store CSI with Helm, while the add-on has already created these CRDs.
Fix: Don't install it; use the add-on. If self-management is truly needed (very rare), disable the add-on first.
admission webhook "mutation.azure-workload-identity.io" … duplicate volume / Pod creation fails
Cause: The cluster has built-in WI enabled, and the upstream azure-workload-identity webhook was also installed with Helm.
kubectl get mutatingwebhookconfigurations | grep -i workload helm list -A | grep -i workload
Fix: Uninstall the self-managed webhook.
ExternalSecret status: SecretSyncedError … AADSTS70021 / could not get token
Cause: The SecretStore's serviceAccountRef points to an SA that has no matching federated credential subject, or the SA is missing the client-id annotation.
Fix: Same as M3: check system:serviceaccount:<ns>:<sa>.
1. Check which Service the external metrics APIService currently points to.
kubectl get apiservice v1beta1.external.metrics.k8s.io -o jsonpath='{.spec.service.namespace}/{.spec.service.name}{"\n"}'2. Import the cert-manager chart from quay.io into your own ACR (without going through the local machine).
az acr import -n $ACR --source quay.io/jetstack/charts/cert-manager:v1.21.3 --image mirror/cert-manager:v1.21.3
A new colleague submits a PR: add KEDA, cert-manager and external-secrets to the myapp chart's dependencies, so “one helm install sets up the whole environment.” How would you review it?
Reject. Platform components are cluster-level shared resources (CRDs, webhooks, APIServices); putting them in a business chart causes: each business carries its own copy and they conflict; uninstalling a business deletes cluster-wide controllers and CRDs; and versions get tied to the business's release cadence. KEDA uses the AKS add-on; cert-manager / ESO are managed by the platform as separate releases (Helmfile or GitOps, Lesson 5). The business chart renders only consumer objects such as ScaledObject, Certificate and ExternalSecret, and uses Capabilities to check whether the CRDs exist.
Verified teaching videos
Official docs
- KEDA in AKS (add-on limitations)
- AKS cluster extensions
- cert-manager: Helm installation
- ESO: Azure Key Vault provider
Video storyboard (about 80 seconds)
Scene: three shelves: AKS add-ons, cluster extensions, Helm. The KEDA box appears on two shelves at once, with a red light flashing.
Narration: each platform component can have only one owner. First ask whether AKS has a managed version.
Scene: the APIService is like a socket with only one plug, and two KEDA installs fight to plug in.
Narration: the external metrics API can point to only one service, so the cluster can have only one KEDA.
Scene: the business chart carries only small cards such as ScaledObject and HTTPRoute; the platform chart is deployed separately.
Narration: the business chart renders only the objects that use platform capabilities, and does not carry the platform components themselves.
Module 6 · Pipeline Deployment to AKS (Pipelines / Actions)
- Design least privilege for the deployment identity: ACR AcrPull, AKS Cluster User Role (download kubeconfig), namespace-scoped Azure Kubernetes Service RBAC Writer (including read/write on release Secrets).
- Write both the GitHub Actions and Azure Pipelines deployment pipelines, with no long-lived keys and no interactive login throughout.
- Understand how
--rollback-on-failure,--wait,--timeout,--history-maxcombination of these in Helm 4, and the errors caused by concurrent deploymentsanother operation is in progress.
What: the five stages of one pipeline deployment
| # | Stage | GitHub Actions | Azure Pipelines | Artifact / token |
|---|---|---|---|---|
| 1 | OIDC → Azure | azure/login@v3 (permissions: id-token: write) | ARM service connection (workload identity federation) + AzureCLI@2 | Entra access token (az CLI session) |
| 2 | kubeconfig | azure/aks-set-context@v5 | az aks get-credentials | non-admin kubeconfig (exec plugin) |
| 3 | kubelogin | azure/use-kubelogin + use-kubelogin: true or kubelogin convert-kubeconfig -l azurecli | KubeloginInstaller@0 + convert-kubeconfig -l azurecli | AKS audience (6dae42f8-…) Entra token |
| 4 | ACR login | az acr login --expose-token | helm registry login --password-stdin (same on both sides, does not depend on Docker) | ACR refresh token (about 3 hours) | |
| 5 | Deploy | helm upgrade --install … --rollback-on-failure --wait --timeout 5m --history-max 10 | release Secret v(N+1) | |
Why: why combine it this way
- OIDC: there is no client secret to rotate or leak; the federated credential subject binds “which repository / which environment / which service connection” to the Azure identity.
- non-admin kubeconfig + kubelogin: operations show up in the API audit log as this managed identity; Azure RBAC can scope access to the namespace.
- --rollback-on-failure: when an upgrade fails (readiness wait timeout, hook failure), it automatically rolls back to the last successful revision; if the first install fails, it uninstalls. In Helm 4 it replaces
--atomic(the old name still works but prints a deprecation warning); once set, it enables waiting.
How: the least-privilege list (deployment identity id-gh-deployer)
| Scope | Role | Why |
|---|---|---|
| ACR | AcrPull (ABAC mode: Container Registry Repository Reader, scoped to helm/*) | pulls the chart; images are pulled by kubelet, so this identity does not need it |
| AKS cluster resource | Azure Kubernetes Service Cluster User Role | calls listClusterUserCredential to download the kubeconfig |
$AKS_ID/namespaces/myapp | Azure Kubernetes Service RBAC Writer | read/write Deployments, Services, Secrets (release storage), etc.; does not include RBAC objects |
| (optional) cluster-level read-only | Azure Kubernetes Service RBAC Reader (cluster scope) | if the chart uses lookup or .Capabilities needs API discovery (the discovery API itself is open to authenticated users) |
If the chart creates Role/RoleBinding, it needs “RBAC Admin” level; if it creates cluster-level resources (CRDs, ClusterRole), the business pipeline should not deploy them.
When: how to choose Helm parameters
| Parameter | Recommendation | Notes |
|---|---|---|
--install | always add | one command handles first and later deployments |
--rollback-on-failure | in production add | replacing the old --atomic; automatically roll back on failure |
--wait / --timeout | --wait --timeout 5m | Helm 4's wait is based on kstatus; the timeout must be longer than the rolling update time |
--history-max | 10 | limit the number of release Secrets (default 10) |
--force-replace | avoid | the old --force, which deletes and recreates resources and interrupts service |
--version or @sha256: | must | do not let the pipeline “take the latest” |
--take-ownership | only during migration | to adopt existing resources that do not belong to this release |
Comparison with similar technologies
| script helm (this lesson) | HelmDeploy@1 (Azure Pipelines task) | azure/k8s-deploy (Actions) | |
|---|---|---|---|
| Helm 4 parameters | fully controllable | the task's force inputs map to the old --force,login/push targeting ACR; Helm 4 compatibility follows the task docs | mainly manifest / rendering; does not manage releases |
| OCI login | --expose-token | built into the task | — |
| recommended | ✓ | simple scenarios | non-Helm scenarios |
az aks get-credentials you can use kubectl”—an Entra cluster still needs kubelogin in non-interactive mode; otherwise it hangs at the device-code prompt until timeout. ② “--rollback-on-failure can roll back database migrations”—it only rolls back Kubernetes objects; migrations in hooks must be designed for backward compatibility yourself (Lesson 6). ③ “Adding --admin means kubelogin is no longer needed”—that is true, but it is exactly the practice to avoid. ④ “Deploying from two pipelines at once is fine”—it leads to another operation (install/upgrade/rollback) is in progress, so serialize them with concurrency or an exclusive lock.Token flow in the pipeline
--rollback-on-failure decision
Interactive: one pipeline deployment (failure can be injected)
Choose the image tag to deploy and click “Run pipeline.” When you pick a tag that does not exist, 1.2.0 the readiness wait times out; observe --rollback-on-failure how the release is pulled back to the last successful revision.
Azure-side preparation (one-time)
az identity create -g $RG -n id-gh-deployer DEP_CLIENT=$(az identity show -g $RG -n id-gh-deployer --query clientId -o tsv) DEP_OBJ=$(az identity show -g $RG -n id-gh-deployer --query principalId -o tsv) # GitHub: subject bound to repository + environment (Azure DevOps uses sc://<org>/<project>/<service-connection>) az identity federated-credential create -g $RG --identity-name id-gh-deployer -n gh-aks-lab \ --issuer https://token.actions.githubusercontent.com \ --subject repo:YOUR_ORG/myapp:environment:aks-lab --audiences api://AzureADTokenExchange AKS_ID=$(az aks show -g $RG -n $AKS --query id -o tsv) az role assignment create --assignee-object-id $DEP_OBJ --assignee-principal-type ServicePrincipal \ --role AcrPull --scope $(az acr show -n $ACR --query id -o tsv) az role assignment create --assignee-object-id $DEP_OBJ --assignee-principal-type ServicePrincipal \ --role "Azure Kubernetes Service Cluster User Role" --scope $AKS_ID az role assignment create --assignee-object-id $DEP_OBJ --assignee-principal-type ServicePrincipal \ --role "Azure Kubernetes Service RBAC Writer" --scope $AKS_ID/namespaces/$NS
GitHub Actions: .github/workflows/deploy-aks.yml
name: deploy-myapp-aks
on:
workflow_dispatch:
inputs:
chartVersion: { description: "chart version in ACR", required: true, default: "0.5.0" }
imageTag: { description: "myapp image tag", required: true, default: "1.1.0" }
permissions:
id-token: write # request an OIDC token
contents: read
concurrency:
group: deploy-aks-lab # serialize, to avoid "another operation is in progress"
cancel-in-progress: false
env:
RG: rg-helm-lab
AKS: aks-helm-lab
ACR: ${{ vars.ACR_NAME }}
NS: myapp
jobs:
deploy:
runs-on: ubuntu-latest
environment: aks-lab # must match the environment in the federated credential subject
steps:
- uses: actions/checkout@v5
- uses: azure/login@v3
with:
client-id: ${{ vars.AZURE_CLIENT_ID }}
tenant-id: ${{ vars.AZURE_TENANT_ID }}
subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
- uses: azure/setup-helm@v5
with: { version: v4.3.2 }
- uses: azure/use-kubelogin@v1
with: { kubelogin-version: v0.2.22 }
- uses: azure/aks-set-context@v5
with:
resource-group: ${{ env.RG }}
cluster-name: ${{ env.AKS }}
use-kubelogin: "true"
- name: kubelogin non-interactive (reuse az session)
run: kubelogin convert-kubeconfig -l azurecli
- name: helm registry login (no Docker)
run: |
az acr login -n "$ACR" --expose-token --query accessToken -o tsv \
| helm registry login "$ACR.azurecr.io" -u 00000000-0000-0000-0000-000000000000 --password-stdin
- name: helm upgrade --install
run: |
helm upgrade --install myapp "oci://$ACR.azurecr.io/helm/myapp" \
--version "${{ inputs.chartVersion }}" -n "$NS" \
-f deploy/values-aks.yaml --set image.tag="${{ inputs.imageTag }}" \
--rollback-on-failure --wait --timeout 5m --history-max 10
- name: report
if: always()
run: helm history myapp -n "$NS" --max 5
action major versions verified 2026-11: azure/login v3.1.0,azure/aks-set-context v5.0.1,azure/setup-helm v5.1.0,azure/use-kubelogin v1.3. In production, pin the action to a full commit SHA (GitHub Lesson 5).
Azure Pipelines: azure-pipelines-deploy.yml
trigger: none
pool:
vmImage: ubuntu-latest
variables:
RG: rg-helm-lab
AKS: aks-helm-lab
ACR: acrhelmlab12345
NS: myapp
chartVersion: 0.5.0
imageTag: 1.1.0
stages:
- stage: deploy
jobs:
- deployment: aks
environment: aks-lab # approvals and checks (ADO Lesson 3 Module 3)
strategy:
runOnce:
deploy:
steps:
- checkout: self
- task: HelmInstaller@1
inputs: { helmVersionToInstall: v4.3.2 }
- task: KubeloginInstaller@0
- task: AzureCLI@2
inputs:
azureSubscription: sc-helm-lab # ARM service connection (workload identity federation)
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
set -euo pipefail
az aks get-credentials -g $(RG) -n $(AKS) --overwrite-existing
kubelogin convert-kubeconfig -l azurecli
az acr login -n $(ACR) --expose-token --query accessToken -o tsv \
| helm registry login $(ACR).azurecr.io -u 00000000-0000-0000-0000-000000000000 --password-stdin
helm upgrade --install myapp oci://$(ACR).azurecr.io/helm/myapp \
--version $(chartVersion) -n $(NS) -f deploy/values-aks.yaml \
--set image.tag=$(imageTag) \
--rollback-on-failure --wait --timeout 5m --history-max 10
The identity behind the service connection needs the same three roles; the federated credential subject format is sc://<organization>/<project>/<service connection name> (generated by Azure DevOps when the service connection is created; see ADO Lesson 3). HelmInstaller@1 / KubeloginInstaller@0 Input names for the task follow the task reference docs.
Lab 6: upgrade myapp with GitHub Actions and rehearse automatic rollback (about 10 min)
myapp, commit deploy/values-aks.yaml (the content from Labs 2–4) and the workflow above; in Settings → Environments create aks-lab; in Variables set AZURE_CLIENT_ID (= $DEP_CLIENT),AZURE_TENANT_ID,AZURE_SUBSCRIPTION_ID,ACR_NAME. These are identifiers, not secrets.YOUR_ORG with your organization or username), then wait 1–2 minutes for the role assignments to propagate.Run azure/login@v3 Federated token details: issuer - https://token.actions.githubusercontent.com subject claim - repo:YOUR_ORG/myapp:environment:aks-lab Login successful. Run kubelogin convert-kubeconfig -l azurecli Run az acr login … | helm registry login … Login Succeeded Run helm upgrade --install myapp "oci://acrhelmlab12345.azurecr.io/helm/myapp" … Pulled: acrhelmlab12345.azurecr.io/helm/myapp:0.5.0 Release "myapp" has been upgraded. Happy Helming! REVISION: 5
1.2.0. About 5 minutes later the job fails:
Error: UPGRADE FAILED: release myapp failed, and has been rolled back due to rollback-on-failure being set: resource Deployment/myapp/myapp not ready. status: InProgress, message: Available: 1/2 REVISION UPDATED STATUS CHART APP VERSION DESCRIPTION 4 … superseded myapp-0.5.0 1.0.0 Upgrade complete 5 … superseded myapp-0.5.0 1.0.0 Upgrade complete 6 … failed myapp-0.5.0 1.0.0 Upgrade "myapp" failed: resource Deployment/myapp/myapp not ready… 7 … deployed myapp-0.5.0 1.0.0 Rollback to 5
Error wording follows the actual Helm 4.3 output. Traffic was not interrupted: the new ReplicaSet's Pods were stuck in ImagePullBackOff, while the old Pods kept serving thanks to the maxUnavailable setting; after rollback the new RS was scaled to 0.
helm history myapp -n $NS kubectl get events -n $NS --sort-by=.lastTimestamp | tail -5
In the AKS audit logs in Azure Monitor (if diagnostic settings are enabled), the user for change operations is the object ID of id-gh-deployer , not clusterAdmin.
Case 1: device code hung for 1 hour
Problem: A new pipeline hangs at To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code … until the job times out. Root cause:az aks get-credentials The generated kubeconfig defaults to devicecode login mode, and was not converted by running kubelogin convert-kubeconfig -l azurecli (or workloadidentity). Fix: Permanently add the conversion step in the template, and set timeout-minutes on the helm step. Limitation:azurecli The pattern depends on the az session in the same job; across jobs you must log in again.
Case 2: two pipelines deploying at the same time leave the release stuck in pending-upgrade
Problem: A hotfix pipeline runs alongside the regular release; one reports another operation (install/upgrade/rollback) is in progress, and after the other is cancelled the release is left at pending-upgrade. Fix: Actions uses concurrency, while Azure Pipelines uses the environment's “exclusive lock” check; do not use cancel-in-progress: true to cancel a running helm. How to recover a stuck release is covered in Lesson 7. Limitation: Serialization lengthens the release queue, so group by environment.
Case 3: deployment identity has too much permission
Problem: To save effort, the pipeline identity was given subscription-level Contributor + cluster RBAC Cluster Admin, and one wrong operation helm uninstall deleted the platform's cert-manager. Fix: Rebuild it per this module's least-privilege list; platform releases use a separate identity and pipeline. Limitation: A namespace-level Writer cannot create Namespaces, so namespaces are pre-created by the platform (or the chart does not use --create-namespace).
Common errors and fixes
AADSTS700213: No matching federated identity record found for presented assertion subject 'repo:org/myapp:ref:refs/heads/main'
Cause: the workflow does not declare environment: aks-lab, so the token's subject becomes the branch format and no longer matches the federated credential (in Azure DevOps, the service connection name does not match). The specific AADSTS number may be 70021 or 700213 depending on the scenario; go by the original error text.
Fix: add environment to the job, or create a separate federated credential for the branch subject (not recommended for production).
Error: Kubernetes cluster unreachable: … To sign in, use a web browser to open the page https://microsoft.com/devicelogin …
Cause: The kubeconfig is still in devicecode mode.
kubelogin convert-kubeconfig -l azurecli
Error: UPGRADE FAILED: another operation (install/upgrade/rollback) is in progress
Cause: Concurrent deployments, or a previous helm run was cancelled and left the release in pending-*.
helm history myapp -n myapp --max 3 helm status myapp -n myapp
Fix: After confirming no deployment is running,helm rollback myapp <previous deployed revision> -n myapp; see Lesson 7 for details.
Error: UPGRADE FAILED: … forbidden: User "…" cannot get resource "secrets" … in the namespace "myapp": User does not have access to the resource in Azure. Update role assignment to allow access.
Cause: The deployment identity lacks the namespace-scoped Azure RBAC role, or the assignment was just made and has not propagated yet (this can take several minutes).
Fix: Assign “Azure Kubernetes Service RBAC Writer” to $AKS_ID/namespaces/myapp.
Flag --atomic has been deprecated, use --rollback-on-failure instead
Cause: Helm 4 renamed it; the old parameter still works but prints a warning.
Fix: globally replace --atomic → --rollback-on-failure,--force → --force-replace.
1. Write the Azure RBAC role assignment command that scopes the deployment identity to the myapp namespace.
az role assignment create --assignee-object-id $DEP_OBJ --assignee-principal-type ServicePrincipal \ --role "Azure Kubernetes Service RBAC Writer" --scope $AKS_ID/namespaces/myapp
2. In a pipeline shell, complete the ACR login and deploy by digest in one line.
az acr login -n $ACR --expose-token --query accessToken -o tsv | helm registry login $ACR.azurecr.io -u 00000000-0000-0000-0000-000000000000 --password-stdin && helm upgrade --install myapp oci://$ACR.azurecr.io/helm/myapp@$DIGEST -n myapp --rollback-on-failure --wait --timeout 5m
The team wants “merging a PR to main auto-deploys dev, a tag deploys prod, and prod requires manual approval.” How should identities and pipelines be designed?
Two environments (dev, prod), each with its own managed identity and federated credential (subject …:environment:dev / …:environment:prod); the prod identity has Writer only on the prod cluster / namespace, and the prod environment requires reviewers. The chart version is built and pushed only once in CI, and dev and prod deploy the same digest; prod uses --rollback-on-failure, and serializes with concurrency.
Verified teaching videos
Official docs
- azure/aks-set-context · azure/setup-helm · azure/use-kubelogin
- kubelogin authentication modes
- Azure RBAC authorization for AKS (built-in roles and namespace scope)
- helm upgrade parameters
- HelmDeploy@1 task reference
Video storyboard (about 90 seconds)
Scene: the runner holds up an OIDC token; Entra checks “repository + environment” and issues three tickets: ARM, AKS, ACR.
Narration: one federated identity exchanges for three kinds of tokens, with no keys throughout.
Scene: in the kubeconfig, devicecode is replaced with azurecli, and the stuck progress bar starts moving again.
Narration: in the pipeline you must switch kubelogin to non-interactive mode, or it will hang at the device-code login.
Scene: helm upgrades to v6, the Pod fails to pull its image, the timer runs out, and automatic rollback creates v7, whose content equals v5.
Narration: rollback on failure rolls back automatically after the wait times out. The failed revision stays in history for troubleshooting.
Module 7 · Hands-on Troubleshooting in the Cloud
- From the raw error text, tell which layer it belongs to: the helm client (registry / API Server), kubelet, CSI / Entra, or the ingress controller.
- Master the three diagnostic commands and the fix for each class of error: ACR 401/403, OCI reference format, AADSTS700016 / 70021 / 700212, Ingress / HTTPRoute not taking effect, kubelogin interactive failures.
- Inject and fix 4 faults in the lab.
What: the five layers of cloud Helm failures
| Layer | Who reports the error | The error appears at | Typical keywords |
|---|---|---|---|
| ① Registry (chain A) | helm client | helm command output | 401 Unauthorized,403 Forbidden,denied,not found,manifest unknown,invalid_reference |
| ② Kubernetes API authentication / authorization | kubelogin / API Server | helm command output | devicelogin,AzureCLICredential,Kubernetes cluster unreachable,forbidden … does not have access to the resource in Azure |
| ③ Resource readiness (chain B, etc.) | kubelet / controller | Pod events; helm only sees a wait timeout | ErrImagePull,ImagePullBackOff,CrashLoopBackOff,not ready |
| ④ Workload identity / Key Vault | CSI driver / Entra / Key Vault | Pod events FailedMount; application logs | AADSTS700016,AADSTS70021,AADSTS700212,403 … getSecret |
| ⑤ Entry | Gateway / Ingress controller | resource status; curl result | NotAllowedByListeners,BackendNotFound,ADDRESS empty, 404 |
Why: why separate by layer first
“Deployment failed” shows up in the pipeline only as one line of helm error or a timeout. Layers ① and ② fail before helm issues any Kubernetes write at all, so the release gets no new revision; layers ③ and ④ fail after the write, and the release becomes failed (or is rolled back automatically); for layer ⑤, the release shows deployed but users cannot reach it. Knowing the layer tells you whether to look at helm output, Pod events, or resource status.
How: AADSTS quick reference (related to Workload Identity / OIDC)
| Code | Meaning | Common root causes |
|---|---|---|
AADSTS700016 | The application identity cannot be found in the directory | wrong client ID / used principalId / wrong tenant |
AADSTS70021 | No federated identity record matches the submitted assertion | issuer or subject mismatch (SA name, namespace, cluster issuer) |
AADSTS700212 | The audience of the assertion does not match the federated credential | the token audience is not api://AzureADTokenExchange (for example, an identity binding's api://AKSIdentityBinding token is used for direct federation) |
AADSTS700213 | No federated record matches the assertion subject (common in CI scenarios) | GitHub workflow missing environment, or a different branch name |
AADSTS700024 | Client assertion is not within its validity period | projected token expired, node clock skew, or the app cached the token file content |
When: five-step troubleshooting order
- Check whether the helm output is an “immediate failure” or a “wait timeout”.
- Immediate failure: use keywords to tell whether it is the registry (401/403/not found) or the API (devicelogin/forbidden/unreachable).
- Wait timeout:
kubectl get events -n NS --sort-by=.lastTimestampandkubectl describe pod. - FailedMount + AADSTS: check clientId, subject, issuer and audience against the AADSTS table.
- deployed but not reachable: check the Gateway / HTTPRoute status, then the Envoy access logs.
Comparison with similar technologies
| Symptom | On local kind | Extra causes on AKS |
|---|---|---|
| cannot pull the chart | wrong repository address | Entra token expired, tenant, ABAC, private endpoint / firewall |
| cannot connect to the cluster | wrong context | kubelogin mode, authorized IP ranges, private cluster |
| Pod won't start | wrong image name | attach-acr missing, WI / Key Vault mount failure |
--admin—this hides the identity design problem.Map of where errors occur
Interactive: raw error message classifier
Paste (or pick from the dropdown) a real error message; the classifier tells you which layer it belongs to, the most likely root cause, and which three commands to run first. Matching is keyword-based and is only a starting point for troubleshooting.
Diagnostic command quick reference (by layer)
| Layer | Command | What to check |
|---|---|---|
| ① | helm pull oci://… --version V --debug | request URL, status code |
| ① | az acr check-health -n $ACR --yes | DNS, connectivity, credentials |
| ① | az acr repository show-tags -n $ACR --repository helm/myapp | whether the path and version exist |
| ① | az role assignment list --scope <acr id> --assignee <id> | AcrPull / Repository Reader |
| ② | kubectl config view --minify -o jsonpath='{.users[0].user.exec.args}' | kubelogin login mode |
| ② | kubelogin get-token --login azurecli --server-id 6dae42f8-4368-4678-94ff-3960e28e3630 | jq -r .status.expirationTimestamp | whether a token can be obtained non-interactively |
| ② | kubectl auth can-i create secrets -n myapp | whether Azure RBAC is effective |
| ③ | kubectl get events -n myapp --sort-by=.lastTimestamp | image pull / scheduling / probes |
| ③ | az aks check-acr -g $RG -n $AKS --acr $ACR.azurecr.io | kubelet image pull permission |
| ④ | kubectl describe pod POD -n myapp | sed -n '/Events/,$p' | FailedMount and the raw AADSTS text |
| ④ | az identity federated-credential list -g $RG --identity-name id-myapp -o table | issuer / subject / audiences |
| ④ | kubectl logs -n kube-system -l app=secrets-store-provider-azure --tail=50 | provider-side errors |
| ⑤ | kubectl get gateway,httproute -A + status | Programmed / Accepted / ResolvedRefs |
| ⑤ | kubectl logs -n gateway-system deploy/shared-approuting-istio --tail=20 | whether the request reaches Envoy |
# one-command capture of the scene (put into a pipeline if: failure() step) NS=myapp; R=myapp helm status $R -n $NS; helm history $R -n $NS --max 5 kubectl get deploy,rs,pod,svc,httproute -n $NS -o wide kubectl get events -n $NS --sort-by=.lastTimestamp | tail -30 for p in $(kubectl get pod -n $NS -o name); do kubectl describe -n $NS $p | sed -n '/Events/,$p'; done
Lab 7: inject 4 faults and fix them (about 9 min)
helm registry logout $ACR.azurecr.io helm show chart oci://$ACR.azurecr.io/helm/myapp --version 0.5.0 2>&1 | tail -1 # fix az acr login -n $ACR --expose-token --query accessToken -o tsv | helm registry login $ACR.azurecr.io -u 00000000-0000-0000-0000-000000000000 --password-stdin
Error: failed to authorize: failed to fetch oauth token: unexpected status from POST request to https://acrhelmlab12345.azurecr.io/oauth2/token: 401 Unauthorized
helm push myapp-0.5.0.tgz oci://$ACR.azurecr.io/helm/myapp # an extra chart name was written az acr repository list -n $ACR -o tsv # shows helm/myapp/myapp helm show chart oci://$ACR.azurecr.io/helm/myapp/myapp --version 0.5.0 | head -2 az acr repository delete -n $ACR --repository helm/myapp/myapp --yes # clean up the wrong repository
helm upgrade myapp oci://$ACR.azurecr.io/helm/myapp --version 0.5.0 -n $NS -f values-aks.yaml \ --set azure.workloadIdentity.clientId=11111111-2222-3333-4444-555555555555 --timeout 3m --wait || true kubectl get events -n $NS --field-selector reason=FailedMount | tail -2 helm rollback myapp -n $NS # back to the last successful revision
Warning FailedMount … MountVolume.SetUp failed for volume "kv-secrets" : rpc error: … AADSTS700016: Application with identifier '11111111-2222-3333-4444-555555555555' was not found in the directory …
kubelogin convert-kubeconfig -l devicecode timeout 20 kubectl get ns || echo "exit=$? (killed by timeout: waiting for device-code login)" kubelogin convert-kubeconfig -l azurecli # fix kubectl get ns | head -3
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code ABCD-EFGH to authenticate. exit=124 (killed by timeout: waiting for device-code login) NAME STATUS AGE default Active 3h gateway-system Active 40m
In the pipeline no one can enter a device code, so the job hangs until it times out. Another common variant: -l azurecli but the current job does not have az login, reporting AzureCLICredential: ERROR: Please run 'az login' to setup account.
gateway-access label (see step 4 of the M4 lab), and walk through the “entry” branch of the troubleshooting tree.helm history myapp -n $NS the latest revision is deployed; kubectl get pods -n $NS all Running.Case 1: every pipeline got 401 on Monday morning
Problem: Over the weekend ACR was switched to “private endpoint access only,” so all helm calls from GitHub-hosted runners got 401/403 (actually denied: client with IP … is not allowed access). Diagnosis:helm pull --debug shows 403 with a message containing an IP; az acr show --query publicNetworkAccess is Disabled. Fix: switch deployment to a self-hosted runner inside the VNet; or allow the runner's egress through the ACR firewall (the hosted runner IP range is very large, so not recommended). Limitation: A private ACR needs a private DNS zone privatelink.azurecr.io, and the runner must be able to resolve it.
Case 2: AADSTS700024 appears every other day
Problem: A Java service that has been running for more than 24 hours reports AADSTS700024: Client assertion is not within its valid time range when accessing Key Vault. Root cause: the app itself reads AZURE_FEDERATED_TOKEN_FILE and caches the content; the projected token on disk has been refreshed, but the app keeps using the old assertion. Fix: upgrade the Azure Identity library (re-read the file before each exchange), or change custom code to read the file before each exchange. Limitation: The official guidance is not to hard-code the token path, and not to cache its contents.
Case 3: some users get 404 after the Gateway migration
Problem: After switching to approuting-istio, requests with the www. prefix return 404. Root cause: HTTPRoute hostnames only the bare domain was written, while the old Ingress rules had a wildcard. Fix: change the chart's ingress.host to a list hosts, and HTTPRoute renders multiple hostnames; count the 404s in the Envoy access logs by :authority . Limitation: The listener's hostname and the route's hostnames must intersect.
Interactive troubleshooting tree: from symptom to fix
Choose the symptom you see and narrow the scope step by step as prompted. Each leaf node gives the diagnostic command and the fix.
Supplement: five frequently seen raw errors
Error: failed to authorize: failed to fetch oauth token: … 401 Unauthorized
Chain A: not logged in / token expired / wrong tenant. Re-run --expose-token login; in the pipeline, confirm the login step comes before helm and in the same job.
… 403 Forbidden … denied: requested access to the resource is denied
Chain A: the identity has no pull permission, or the ABAC condition does not match, or a network rule denies it (the message contains an IP).
Error: … ref "acrhelmlab.azurecr.io/helm/myapp:0.5.0" not found
Wrong reference path or version: az acr repository list check the actual repository name (for example, whether an extra chart name was written on push).
… AADSTS70021: No matching federated identity record found for presented assertion.
④: check the subject system:serviceaccount:NS:SA and issuer (of the current cluster). This is most common after changing the release name or fullnameOverride.
To sign in, use a web browser to open the page https://microsoft.com/devicelogin …
②: the kubeconfig is in interactive mode. kubelogin convert-kubeconfig -l azurecli (or workloadidentity).
1. Without going through kubectl, test directly whether kubelogin can get an AKS token non-interactively.
kubelogin get-token --login azurecli --server-id 6dae42f8-4368-4678-94ff-3960e28e3630 | jq -r .status.expirationTimestamp
2. List only the FailedMount events in the myapp namespace.
kubectl get events -n myapp --field-selector reason=FailedMount --sort-by=.lastTimestamp
A pipeline's helm step failed after 5 minutes: resource Deployment/myapp/myapp not ready, and it was automatically rolled back. How do you find the root cause within 3 minutes?
This is layer ③/④: helm wrote successfully, but the resources are not ready. Check the events during the failed revision: kubectl get events -n myapp --sort-by=.lastTimestamp | tail -30. If it is ErrImagePull → image tag / attach-acr (az aks check-acr); if it is FailedMount + AADSTS → check against the AADSTS table; if it is a probe failure → kubectl logs --previous. Put this collection command into a pipeline if: failure() step, so you can read the logs directly next time.
Verified teaching videos
No verified video specifically covering “Helm deployment troubleshooting on AKS” was found. The video below is about kubelogin / Entra access to AKS and can serve as a supplement for layer ②:
Official docs
- ACR troubleshooting
- AKS troubleshooting docs
- Microsoft Entra authentication error codes (AADSTS)
- Azure Workload Identity troubleshooting
Video storyboard (about 90 seconds)
Scene: a pipeline turns red; the camera pulls back to reveal a five-story building: registry, API, kubelet, identity, entry.
Narration: when a cloud deployment fails, first work out which layer the error occurred on.
Scene: a 401 bubble drifts up to the ACR floor, an ImagePullBackOff bubble drifts up to the kubelet floor, and an isolation line is drawn between them.
Narration: helm's 401 belongs to the repository chain, and a Pod failing to pull an image belongs to the kubelet chain; do not troubleshoot them together.
Scene: three cards, AADSTS700016, 70021 and 700212, point to the client ID, the subject and the audience respectively.
Narration: the three most common AADSTS errors map to the client ID, the federated credential subject and the token audience.
Scene: a device-code prompt box, with a timer ticking beside it; then it switches to azurecli mode and passes immediately.
Narration: when a pipeline hangs, it is most likely kubelogin waiting for a device code.
Module 8 · Cost, Cleanup and Self-Check
- List the cost breakdown of this lesson's labs, and estimate the gap between “delete right after” and “forget for a month.”
- Distinguish
helm uninstall,az aks stop, andaz group deleteby their effects and suitable scenarios. - Know what is left behind after deleting the resource group: Key Vault soft delete (name still taken), local kubeconfig / helm credentials, and variables and service connections in the CI platform.
What: the cost breakdown of this lesson's labs (canadacentral, order-of-magnitude estimate)
| Resource | Spec | About USD/hour | Notes |
|---|---|---|---|
| AKS control plane | Free tier | 0 | no SLA; production uses Standard (billed per cluster hour) |
| Node VMs | 2 × Standard_D2s_v5 (Linux) | ≈ 0.19 | The main cost; billed per second, stops when deleted |
| OS managed disk | 2 × 128 GiB | ≈ 0.03–0.05 | D2s_v5 has no local temporary disk, so a managed OS disk is used |
| Standard load balancer + public IP | outbound IP + Gateway IP | ≈ 0.03–0.04 | each LoadBalancer Service (each Gateway) adds rules and an IP |
| ACR | Basic | ≈ 0.007 (about 0.167/day) | includes 10 GiB storage; ACR Tasks (build / purge) billed per second separately |
| Key Vault | Standard | ≈ 0 | billed per operation (a few cents per 10,000 operations); CSI polling generates a small number of operations |
| managed identity, federated credentials, role assignments | — | 0 | not billed, but must be cleaned up |
| Total | ≈ 0.27 | 2-hour lab ≈ 0.6 USD; forgetting to delete for a month ≈ 190 USD |
Prices vary by region, contract and time; refer to the Azure pricing calculatorfor the authoritative figures; prices in the expected outputs are examples.
Why: why cleanup is a module of its own
- Node VMs bill by the hour continuously, regardless of whether there is traffic.
- Key Vault defaults to soft delete (retention defaults to 90 days); after the resource group is deleted, a Key Vault with the same name is still taken, so creating one with the same name next time will fail.
- Federated credentials, CI platform variables and local kubeconfigs do not disappear on their own; leaving them causes confusion, and can even grant unexpected access when someone rebuilds a resource with the same name.
How: comparing three ways to “stop”
helm uninstall myapp | az aks stop | az group delete | |
|---|---|---|---|
| What is deleted | release-managed K8s objects + release Secrets (the Gateway's LB IP is released with them) | stop the control plane and nodes (state kept) | all Azure resources in the resource group (including the MC_ node resource group) |
| Cost | nodes keep billing as usual | node compute stops billing; disks, public IPs etc. may keep billing (see official docs) | everything stops (soft-deleted Key Vault is not billed) |
| Recovery | helm install | az aks start (a few minutes) | rebuild |
| Suitable for | cleaning up the app | continuing the lab the next day | end of this lesson |
When: cleanup order
helm uninstallDelete the app and optional platform charts first (so the LB / public IP is released and resource group deletion does not get stuck)az group delete -n rg-helm-lab --yes --no-wait.az keyvault purgePurge the soft-deleted Key Vault (can be purged immediately if purge protection is not enabled).- Delete the local kubeconfig context,
helm registry logout. - Delete the GitHub repository variables / environment and the Azure DevOps service connection.
- Verify:
az group exists,az keyvault list-deleted, and check the subscription cost analysis.
Comparison with similar technologies
| This lesson (resource-group centric) | Managed with Terraform (Terraform course) | |
|---|---|---|
| Cleanup method | az group delete | terraform destroy |
| Risk of leftovers | Things outside the resource group (subscription-level roles, CI configuration) | Resources created manually outside the state |
Cleanup scope map
Interactive: cost estimator
Adjust the number of nodes, VM size, run time and ACR SKU to see the gap between “delete right after” and “forget to delete.” Unit prices are order-of-magnitude illustrative values for 2026, only for building cost intuition.
Cleanup commands
source ~/helm-lab.env # retrieve the ACR / KV names helm uninstall myapp -n myapp helm uninstall cert-manager -n cert-manager 2>/dev/null || true kubectl delete gateway shared -n gateway-system --ignore-not-found az group delete -n rg-helm-lab --yes --no-wait az group wait -n rg-helm-lab --deleted --timeout 1800 az keyvault list-deleted --query "[].name" -o tsv az keyvault purge -n $KV --location canadacentral kubectl config delete-context aks-helm-lab; kubectl config delete-cluster aks-helm-lab kubectl config delete-user clusterUser_rg-helm-lab_aks-helm-lab helm registry logout $ACR.azurecr.io 2>/dev/null || true az group exists -n rg-helm-lab
release "myapp" uninstalled kv-helm-lab-12345 false
Continue the next day: stop and start
az aks stop -g rg-helm-lab -n aks-helm-lab az aks show -g rg-helm-lab -n aks-helm-lab --query powerState.code -o tsv # Stopped az aks start -g rg-helm-lab -n aks-helm-lab
CI platform cleanup
gh variable delete AZURE_CLIENT_ID -R YOUR_ORG/myapp gh variable delete ACR_NAME -R YOUR_ORG/myapp gh api -X DELETE repos/YOUR_ORG/myapp/environments/aks-lab # Azure DevOps: Project settings → Service connections → delete sc-helm-lab (or az devops service-endpoint delete --id <id>)
Budget alert (recommended to set before starting the lab)
az consumption budget create --budget-name helm-lab --amount 20 --time-grain Monthly \ --start-date 2026-11-01 --end-date 2027-01-31 --category Cost --resource-group rg-helm-lab
az consumption budget The parameters and notification configuration follow the CLI docs; you can also set email notifications in the portal under “Cost Management → Budgets.”
Lab 8: full cleanup and verification (about 5 min; asynchronous deletion takes 5–15 min)
helm list -A helm uninstall myapp -n myapp kubectl delete gateway shared -n gateway-system --ignore-not-found kubectl get svc -A --field-selector spec.type=LoadBalancer
az group delete -n rg-helm-lab --yes --no-wait, then az group wait -n rg-helm-lab --deleted.az keyvault list-deleted -o table → az keyvault purge -n $KV --location canadacentral.helm registry logout, GitHub variables and environment, Azure DevOps service connection.az group exists -n rg-helm-lab az resource list --tag created-by=helm-lab -o table # if you tagged the resources az keyvault list-deleted --query "[?name=='$KV']" -o tsv kubectl config get-contexts | grep aks-helm-lab || echo "kubeconfig cleaned up"
false kubeconfig cleaned up
Case 1: the lab cluster ran for a whole quarter
Problem: The training AKS was not deleted by anyone after the course ended, and about 600 USD was spent over three months. Fix: tag all lab resources with owner,expires tags; Azure Policy requires the tags; a daily Automation / Logic App deletes expired resource groups; set budget alerts on the subscription. Limitation: Notify the owner before automatic deletion, to avoid deleting a shared environment by mistake.
Case 2: the Key Vault name “already exists”
Problem: When the lab was run a second time, az keyvault create reported VaultAlreadyExists, but no such Key Vault could be found in the subscription. Root cause: after the last resource group was deleted, the Key Vault entered soft delete. Fix:az keyvault recover recover and reuse it, or purge and then rebuild it; in the lab scripts, the Key Vault name carries a random suffix. Limitation: Production Key Vaults should have purge protection enabled; once it is enabled, the vault cannot be purged within the retention period.
Case 3: too many Gateways causing public IP costs
Problem: Each feature branch's preview environment gateway.create=true, and dozens of public IPs and LB rules are billed continuously. Fix: Preview environments share one Gateway and are distinguished by hostname; when a branch is closed, the pipeline runs helm uninstall. Limitation: The number of listeners on the shared Gateway and certificate management need to be planned.
Common errors and fixes
(VaultAlreadyExists) The vault name 'kv-helm-lab-12345' is already in use.
Soft delete holds the name: az keyvault list-deleted → az keyvault purge -n NAME --location canadacentral or recover.
az group delete stays in Deleting for a long time
This is common when the LB / public IP is still referenced. First helm uninstall and delete the Gateway, then delete the resource group; you can see the stuck resources in the portal's “Activity log.”
(OperationNotAllowed) … cannot be stopped/started …
Some configurations (such as NAP enabled / certain add-on combinations) do not support stop; follow the error message from az aks stop and the official docs; in that case, delete directly.
After deletion, kubectl reports dial tcp: lookup aks-helm-lab-….azmk8s.io: no such host
the kubeconfig still points to the deleted cluster: kubectl config delete-context aks-helm-lab, switch to the kind context kubectl config use-context kind-lab.
1. Why does helm still get 401 after attach-acr?
attach-acr only assigns AcrPull to the kubelet managed identity (chain B); the chart pull done by helm uses the identity running helm (chain A), which must log in itself and have AcrPull.
2. Why must serviceAccount.name be set explicitly when enabling WI?
The federated credential subject is system:serviceaccount:NS:SA, and the SA name defaults to fullname, which changes with the release name / fullnameOverride, causing AADSTS70021.
3. What is the current status of approuting-istio and managed NGINX?
Managed NGINX (Ingress) stops Azure support after 2026-11; the Gateway API implementation approuting-istio is GA and is enabled by default on AKS Automatic 1.36+; it requires the Managed Gateway API CRDs.
4. Why should a business chart not carry KEDA?
A cluster can have only one external metrics server; KEDA is a cluster-level component, and AKS offers it as an add-on; uninstalling the business would delete a platform component.
5. What to do when the pipeline hangs on a device code?
kubelogin convert-kubeconfig -l azurecli (if azure/login was already done in the same job) or -l workloadidentity.
6. What three things must be done after deleting the resource group?
Purge the soft-deleted Key Vault; clean up the local kubeconfig / helm credentials; delete the CI platform's variables, environment and service connection.
Verified teaching videos
No verified video specifically covering AKS lab costs and cleanup was found; refer to the official docs and the storyboard below.
Official docs
- Stop and start an AKS cluster
- Key Vault soft delete
- AKS Free / Standard / Premium tiers
- Azure pricing calculator
Video storyboard (about 60 seconds)
Scene: the meter keeps ticking above two VMs; after the helm uninstall button is pressed, the meter is still ticking.
Narration: uninstalling the app does not stop billing; the nodes are the main cost.
Scene: the resource group is deleted; a Key Vault icon turns into a translucent “ghost” still holding the name.
Narration: after the resource group is deleted, the Key Vault enters soft delete, and the name stays taken during the retention period.
Scene: a checklist is ticked item by item: resource group, Key Vault purge, kubeconfig, CI variables.
Narration: clean up following the checklist, then confirm with az group exists.
Command Cheat Sheet
ACR · OCI chart
# Login (no Docker) az acr login -n $ACR --expose-token --query accessToken -o tsv \ | helm registry login $ACR.azurecr.io -u 00000000-0000-0000-0000-000000000000 --password-stdin helm package myapp helm push myapp-0.5.0.tgz oci://$ACR.azurecr.io/helm # only up to the namespace helm show chart oci://$ACR.azurecr.io/helm/myapp --version 0.5.0 helm pull oci://$ACR.azurecr.io/helm/myapp --version 0.5.0 az acr repository show-tags -n $ACR --repository helm/myapp -o tsv az acr manifest list-metadata -r $ACR -n helm/myapp -o table az acr run -r $ACR --cmd "acr purge --filter 'helm/myapp:.*' --ago 30d --keep 5 --untagged --dry-run" /dev/null az aks check-acr -g $RG -n $AKS --acr $ACR.azurecr.io # chain B (kubelet)
Deploy
helm upgrade --install myapp oci://$ACR.azurecr.io/helm/myapp --version 0.5.0 \ -n myapp -f values-aks.yaml --rollback-on-failure --wait --timeout 5m --history-max 10 helm upgrade --install myapp oci://$ACR.azurecr.io/helm/myapp@sha256:<digest> -n myapp helm history myapp -n myapp helm rollback myapp <REV> -n myapp
AKS credentials and kubelogin
az aks get-credentials -g $RG -n $AKS --overwrite-existing # do not use --admin kubelogin convert-kubeconfig -l azurecli # local machine / pipeline kubelogin convert-kubeconfig -l workloadidentity # running in a Pod with WI kubectl auth whoami kubectl auth can-i create secrets -n myapp
Workload Identity · Key Vault
az identity create -g $RG -n id-myapp ISSUER=$(az aks show -g $RG -n $AKS --query oidcIssuerProfile.issuerUrl -o tsv) az identity federated-credential create -g $RG --identity-name id-myapp -n fc-myapp \ --issuer "$ISSUER" --subject system:serviceaccount:myapp:myapp --audiences api://AzureADTokenExchange az role assignment create --role "Key Vault Secrets User" --assignee-object-id <principalId> \ --assignee-principal-type ServicePrincipal --scope <kv id> helm template t ./myapp -f values-aks.yaml --api-versions secrets-store.csi.x-k8s.io/v1 \ --show-only templates/secretproviderclass.yaml
Entry
az aks update -g $RG -n $AKS --enable-gateway-api --enable-app-routing-istio
kubectl get gatewayclass approuting-istio
kubectl get gateway,httproute -A
kubectl get httproute -n myapp -o jsonpath='{.items[0].status.parents[0].conditions}'
Add-on inventory
az aks show -g $RG -n $AKS --query "{kv:addonProfiles.azureKeyvaultSecretsProvider.enabled, keda:workloadAutoScalerProfile.keda.enabled, wi:securityProfile.workloadIdentity.enabled}"
kubectl get apiservice v1beta1.external.metrics.k8s.io -o jsonpath='{.spec.service}'
kubectl get csidrivers; kubectl get mutatingwebhookconfigurations
helm list -A
Cleanup
helm uninstall myapp -n myapp az group delete -n rg-helm-lab --yes --no-wait az keyvault purge -n $KV --location canadacentral kubectl config delete-context aks-helm-lab
Helm 3 → 4 parameter comparison (covered in this lesson)
| Helm 3 | Helm 4 | Notes |
|---|---|---|
--atomic | --rollback-on-failure | deprecation warning for old name |
--force | --force-replace | deprecation warning for old name |
helm registry login https://host/path | helm registry login host[:port] | accepts only hostnames |
| client-side merge (three-way merge) | new installs default to server-side apply | field conflicts: see Lesson 7 |
Capstone Lab + Final Quiz
--admin; a failed upgrade must roll back automatically without affecting production; after the lab, all resources are cleaned up.kubectl get gatewayclass approuting-istio is True.serviceaccount.yaml (merging the WI annotation),secretproviderclass.yaml, Pod labels / volumes / checksum on the Deployment,httproute.yaml,gateway.yaml,ingress.yaml, NOTES.txt; update values.schema.json (ingress.mode enumeration,clientId uuid format).
helm lint myapp helm template t ./myapp --set azure.keyVault.enabled=true 2>&1 | grep -q "requires azure.workloadIdentity" && echo "fail validation OK" helm template t ./myapp -f values-aks.yaml --api-versions secrets-store.csi.x-k8s.io/v1 \ --api-versions gateway.networking.k8s.io/v1/HTTPRoute | kubectl apply --dry-run=server -f - -n myapp
sed -i 's/^version:.*/version: 1.0.0/' myapp/Chart.yaml helm package myapp az acr login -n $ACR --expose-token --query accessToken -o tsv | helm registry login $ACR.azurecr.io -u 00000000-0000-0000-0000-000000000000 --password-stdin helm push myapp-1.0.0.tgz oci://$ACR.azurecr.io/helm | tee push.log DIGEST=$(grep -o 'sha256:[a-f0-9]*' push.log)
id-myapp (federated credential subject system:serviceaccount:myapp:myapp, Key Vault Secrets User) and id-gh-deployer (GitHub environment subject, AcrPull + Cluster User Role + namespace-level RBAC Writer). On the platform side, create gateway-system/shared Gateway, and label the myapp namespace with gateway-access=true label.chartVersion=1.0.0,imageTag=1.0.0; change the --version in the workflow to deploy by digest (you can add the chartDigest input). Verify:
kubectl get pods -n myapp
kubectl exec -n myapp deploy/myapp -- ls /mnt/secrets-store
IP=$(kubectl get gateway shared -n gateway-system -o jsonpath='{.status.addresses[0].value}')
curl -s -H "Host: myapp.example.com" http://$IP/healthzimageTag=1.1.0 ; then upgrade with imageTag=1.2.0 (which does not exist), and confirm the pipeline fails and helm history appears, Rollback to N during the upgrade, the curl loop stays at 200 throughout.
while true; do curl -s -o /dev/null -w "%{http_code} " -H "Host: myapp.example.com" http://$IP/healthz; sleep 1; donemyapp2 (AADSTS70021); helm registry logout then rerun the local helm show (401); remove the namespace label (NotAllowedByListeners). Use the troubleshooting tree to locate and fix each one, and record the raw error text and fix command for each fault.helm uninstall → delete the Gateway → az group delete → az keyvault purge → delete the kubeconfig context and CI variables → az group exists returns false.Acceptance checklist
Open-ended self-check (answer first yourself, then expand the reference answer)
1. Draw the full credential chain of helm upgrade --install oci://… on AKS, marking the token at each hop.
az login / OIDC → Entra token → az acr login --expose-token obtain ACR refresh token → helm registry login → ACR /oauth2/token exchange per repository and action for an access token → GET manifest / blob → render locally → kubeconfig exec kubelogin → AKS-audience Entra token → API Server authentication + Azure RBAC → SSA writes resources and the release Secret → kubelet pulls images with its own managed identity (attach-acr).
2. When would you choose GitOps instead of pipeline push?
Private clusters (hosted runners cannot reach the API Server), multi-cluster consistency, the need for continuous drift correction, or when nothing outside the cluster should hold any cluster credentials. The cost is that the controller's identity and OCI authentication must be designed separately (Lesson 5).
3. Which Azure-related things would you put into the chart, and which would you never put in?
Put in: SA annotations, Pod labels, SecretProviderClass, HTTPRoute, ScaledObject and other “objects that use platform capabilities.” Never put in: managed identities, federated credentials, role assignments (IaC); KEDA / CSI / WI webhook / Gateway API CRDs (add-ons); the shared Gateway (platform).
4. What does each of AADSTS700016, 70021 and 700212 check?
700016: client ID / tenant; 70021: the federated credential's issuer and subject; 700212: the token audience and the federated credential audiences.
5. After managed NGINX stops being supported, what is the migration path for existing Ingress?
Enable Managed Gateway API + approuting-istio; in the chart, add an ingress.mode and HTTPRoute template; the platform creates a shared Gateway; switch values and DNS environment by environment; find alternatives for NGINX-specific annotations (Istio add-on + EnvoyFilter or AGC where necessary).
6. Why can't the ACR retention policy replace acr purge for cleaning up charts?
The retention policy only deletes untagged Docker-media-type manifests and does not support OCI manifests; charts are tagged OCI manifests. Use acr purge to clean up by tag pattern, age and retention count, and it can be scheduled as an ACR task.
Final Quiz (12 questions, covering all modules)
Sources and Version Notes
| Topic | Verification conclusion | Source (page date / accessed 2026-11-15) |
|---|---|---|
| Helm version | v4.3.2 (2026-11-13); --atomic → --rollback-on-failure,--force → --force-replace; new installs default to SSA; registry login accepts only hostnames | helm/helm releases · verified facts from the course standards |
| Helm OCI | push references must not include the chart name and tag; install by digest @sha256:; three media types: config / chart / provenance; .prov is uploaded with the push (the page notes it has not yet been updated for Helm 4) | Use OCI-based registries |
| ACR chart storage | OCI artifacts GA; az acr helm retired on 2025-09-15; --expose-token username is an all-zero GUID; ABAC registries use Container Registry Repository Writer, otherwise AcrPush; az acr manifest list-metadata shows application/vnd.cncf.helm.config.v1+json | Store Helm charts in ACR(updated 2026-06-12) |
| ACR retention policy | Premium, preview; only handles untagged manifests of Docker media type; OCI manifests are not supported and require acr purge; default 7 days, 0–365 | Retention policy(2025-12-18, updated 2026-07-07) |
| application routing Gateway API | GatewayClass approuting-istio; --enable-gateway-api --enable-app-routing-istio (CLI ≥ 2.86); only supports Managed Gateway API CRDs; no EnvoyFilter / sidecar; cannot be enabled together with the Istio add-on; Gateway automatically gets HPA (min 2) + PDB; managed NGINX stops Azure support after 2026-11; default on AKS Automatic 1.36+; GA in 2026-06 | App routing with Gateway API(2026-08-31, updated 2026-11-06) · AKS blog GA announcement (2026-06-10) |
| Workload Identity | SA annotations client-id / tenant-id / service-account-token-expiration (3600–86400); Pod labels azure.workload.identity/use: "true" required; Pod annotations skip-containers, inject-proxy-sidecar; each managed identity can have up to 20 federated credentials; changing annotations requires a Pod restart; do not hard-code or cache the token file; AADSTS700212 means audience mismatch | Workload ID overview(2026-10-06) |
| Key Vault CSI | secrets-store.csi.x-k8s.io/v1; parameters usePodIdentity "false", clientID, keyvaultName, cloudName, objects, tenantId; RBAC mode uses Key Vault Secrets User / Certificate User; add-on azure-keyvault-secrets-provider | CSI identity access(2026-09-02) |
| AKS add-ons / KEDA | add-on list; only patch upgrades within the same K8s minor; the KEDA add-on cannot change Helm values; only one external metrics server is allowed, multiple KEDA not supported; AKS Automatic pre-installs KEDA | Integrations(updated 2026-11-04) · KEDA in AKS(updated 2026-07-03) |
| Upstream component versions | KEDA v2.21.1 (2026-11-15); cert-manager v1.21.3 (2026-10-23); External Secrets v2.15.0 / chart 2.15.0 (2026-11-10); Secrets Store CSI v1.6.2 (2026-11-05); Azure provider v1.8.2 (2026-06-11); azure-workload-identity v1.6.3 (2026-08-31); kubelogin v0.2.22 (2026-10-24) | each project's GitHub Releases (queried via the GitHub API) |
| GitHub Actions | azure/login v3.1.0; azure/aks-set-context v5.0.1 (inputs resource-group, cluster-name, admin, use-kubelogin); azure/setup-helm v5.1.0 (latest may cross a major version, fallback v4.3.1); azure/use-kubelogin v1.3 | each action repo's README and Releases |
| HelmDeploy@1 | Inputs include connectionType, useClusterAdmin, command (login/push/upgrade…), force, etc.; the page does not mention Helm 4 | HelmDeploy@1(2026-09-23) |
| AKS version / K8s course link | AKS 1.37 GA 2026-10; AKS 1.37's KEDA add-on is 2.20.x | K8s Hour 6 source page |
Video verification note
Titles and channels of all videos below were checked via the YouTube oEmbed API (2026-11-15): John Savill's Technical Training, “Azure Kubernetes Services (AKS) Overview” (c4nTKMU6fBU), “Azure Kubernetes Service (AKS) Networking Deep Dive” (6TZsd4toIbg), “GitHub Azure AD OIDC Authentication” (XkhkkLBkAT4); TechWorld with Nana, “What is Helm in Kubernetes? Helm and Helm Charts explained | Kubernetes Tutorial 23” (-ykwb1d0DXU); Akuity, “How to Use Private OCI Helm Repositories in Argo CD” (Hn4pgrySYRU); Terry Howe, “Helm with oras-go v3 Demo Mirroring and Blocking Registries” (3yPa6mz0nas); Anton Putra, “Azure Kubernetes Service (AKS) Tutorial: (Terraform - Nginx Ingress & TLS - OIDC Workload Identity)” (8HmReos6dlY); Lachlan Evenson, “OSS Unboxing: secrets-store-csi-driver - Integrates secrets stores with Kubernetes via a CSI volume” (3wks5Mioclg); Mischa van den Burg, “Tutorial: Autoscaling an Application with KEDA on Azure Kubernetes Service (AKS)” (0cfU5DNy5Z4); That DevOps Guy, “Free SSL for Kubernetes with Cert-Manager” (hoLUigg4V18); Microsoft Developer, “Introduction to External Secrets - Secrets Operator for Kubernetes” (2FOB49oXts8); DevOps & AI Toolkit, “Manage Kubernetes Secrets With External Secrets Operator (ESO)” (SyRZe5YVCVk); Jon Gallant, “Connect to Azure from a GitHub Action with OpenID Connect (OIDC)” (IKuw9T6vZYU); Programming with Wolfgang, “Secure Azure DevOps Access to AKS via Entra ID” (0PFpkZhJUgw). oEmbed does not return durations or publish dates, so durations are not shown on the cards. No verified dedicated videos were found for three topics (application routing Gateway API, Helm troubleshooting in the cloud, and cost cleanup), so storyboards are provided instead. All videos are in English, and most were recorded before Helm 4 / AKS 1.37; for version details, follow this lesson.
Voice narration note
The “Voice” page uses the browser's Web Speech API (speechSynthesis, en-US) to read the narration script aloud, with English terms pronounced in en-US; results depend on the speech packs installed by the operating system. This courseware's generation environment cannot call a TTS service, so no MP3 is embedded; the narration script can be passed directly to tools such as Azure AI Speech to generate audio.
Known limitations
- The commands in this lesson are written from the official docs and were not actually run in this environment; the name suffixes, IPs, digests, GUIDs, times and prices in the “expected output” are example values.
- helm registry error wording varies with the Helm / ORAS version; the forms in this lesson are common ones; follow the HTTP status code in the
--debugoutput. - Helm 4's
--rollback-on-failure--rollback-on-failure automatically enables waiting; for the exact wording of failure messages, followhelm upgrade --helpand the actual output. - The following have been handled conservatively and are marked “follow the official docs”: the effect of the attach-acr role in ACR ABAC mode, and the
roleAssignmentModefield name;az acr importimporting a third-party OCI chart;az aks stopdisk and IP billing during the lab period; the values key names when cert-manager uses Azure DNS; the SecretStore fields for ESO 2.x; the compatibility of HelmDeploy@1 with Helm 4;HelmInstaller@1/KubeloginInstaller@0input names ofaks-set-contextthe specific conversion mode ofuse-kubelogin(so the workflow explicitly runsconvert-kubeconfig -l azurecli). - The label keys for add-on-managed workloads (such as
kubernetes.azure.com/managedby) follow the actual cluster output. - The timing and HTTP interactions in the animation are mechanism illustrations; retries, caching and some request headers are omitted.
- Helm Lessons 1, 2 and 4–8 are being written in parallel with this lesson; cross-lesson references (such as the named template names in Lesson 2) follow the final content of each lesson.