Infrastructure

Azure AKS: diagnose a pending Azure Disk PVC before recreating the volume

A production runbook for separating scheduling, provisioning and mount failures on AKS while protecting existing data.

29 Nov 2026 azureakskubernetesstoragecsiobservabilityrunbookrollbackproduction

A stateful application restarts on AKS, but its replacement pod stays pending and its PersistentVolumeClaim (PVC) never leaves Pending. Deleting the claim to unblock the rollout can produce an empty disk or trigger deletion of the associated volume. Neither outcome proves the data can be recovered.

In this fictional case, a StatefulSet uses Azure Disk through the CSI driver. The runbook separates node selection, volume provisioning and binding, and finally attachment and mounting. The goal is a targeted fix proven on a canary, or a deliberate hold that preserves the existing data.

Protect data and capture evidence

Pause automated changes to the affected workload and notify its owner. Record the UTC incident window, last healthy state, PVC name and UID, consuming pod, and the latest manifest or StorageClass change. Establish that a usable backup exists before any destructive operation. Do not delete the PVC, PV or disk, or remove their finalizers to speed up diagnosis.

NS="orders-prod"
PVC="data-orders-0"
POD="orders-0"

kubectl -n "$NS" get pvc "$PVC" -o yaml > pvc.yaml
kubectl -n "$NS" describe pvc "$PVC" > pvc-events.txt
kubectl -n "$NS" get pod "$POD" -o yaml > pod.yaml
kubectl -n "$NS" describe pod "$POD" > pod-events.txt
kubectl get storageclass -o yaml > storageclasses.yaml
kubectl get nodes -L topology.kubernetes.io/zone > nodes.txt
kubectl -n "$NS" get events --sort-by=.metadata.creationTimestamp > events.txt

These files can contain sensitive metadata; keep them in the approved incident location. Events expire, so capture them early. If the PVC is already Bound, record spec.volumeName, export the corresponding PV and inspect its persistentVolumeReclaimPolicy. Deleting a claim bound to a dynamically provisioned PV with Delete can delete its underlying storage. Retain is not a substitute for a tested backup.

Identify the blocked stage

ObservationHypothesis to checkNext evidence
PVC Pending, class uses WaitForFirstConsumer, no consuming podWaiting may be expectedCreate the intended consumer only after review; do not recreate the claim
PVC and pod both PendingScheduling or provisioning has not completedPod and PVC events, constraints and eligible nodes
PVC reports ProvisioningFailedThe provisioner attempted creationCSI message, identity, quota, SKU, region and Azure activity
PVC Bound, pod reports FailedAttachVolume or FailedMountBinding succeeded; attachment or mounting is a separate stagePod events, PV, node and disk state

An old event may not describe the current state. Compare its timestamp with subsequent attempts. WaitForFirstConsumer delays provisioning or binding until a consuming pod is scheduled; it does not guarantee success. An unschedulable pod can leave the claim pending.

Check the storage contract and scheduling

Inspect the exact storageClassName, provisioner, binding mode, parameters, requested size and access modes. A missing class, incompatible request or quota restriction can prevent creation. For a statically provisioned PV, also check its capacity, access mode, class, status and any reservation. Do not assume CSI must create a new disk.

On the pod, inspect FailedScheduling, selectors, affinities, taints and tolerations, and available node resources. Compare eligible node zones with the StorageClass or PV topology constraints. An already bound volume can constrain the zone: adding a node in a different zone does not resolve that conflict.

Avoid setting spec.nodeName to bypass the scheduler when using WaitForFirstConsumer; delayed binding relies on scheduling. Correct the demonstrated constraint and let the scheduler select a compatible node. If no eligible capacity exists, stop the rollout and obtain a capacity or topology decision before proceeding.

Follow an Azure provisioning failure

Capture the complete PVC event, driver, requested volume and timestamp. Inspect the relevant CSI controller logs using the actual component names in the cluster, then review Azure Activity Log for the resource group and time window. Required permissions depend on scope and storage: identify the identity actually used and the specific denial before changing RBAC. A timeout without evidence of denial is not a reason to grant a broader role.

Separate authorization denial, quota, unavailable SKU or zone, invalid parameters and transient errors. Check whether a disk was created despite an uncertain response. Correlate its identifiers with the PV and logs before acting; never delete it based on its name alone.

When the PVC is already Bound, inspect the PV and pod events instead. A zone conflict, an attachment still active elsewhere, a node volume limit and a mount error require different evidence. Do not force-detach a disk while the old consumer may still write: that risks corruption.

Test a reversible correction

In an isolated namespace, use a disposable PVC and pod with the relevant class and constraints, without production data. Check events, transition to Bound, node and zone, then write and read back a test file. Review the test disk’s reclaim policy and cost before controlled cleanup.

Change one demonstrated cause at a time, such as an incorrect affinity or a specifically denied permission. Record the previous manifest, changed identity and scope, owner, window and stop condition. A new StorageClass or PVC does not move existing data; migration needs a separately validated copy or restore plan.

Decide and roll back

Resume the rollout only when the intended PVC is bound to the right PV, the pod is ready on a compatible node, and the application confirms that its data is present and consistent, with no attachment errors or new failure events. Observe the other replicas and capacity throughout the agreed window.

If the canary fails, or disk identity and data consistency remain uncertain, stop recovery. Restore the previous configuration through its deployment source, remove any temporary permission added for the test, and verify the documented state has returned. Rolling back a manifest does not restore deleted data. Start a restore only after the recovery point and business owner have been confirmed.

References