Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Azure resource operations on an AKS managed cluster or node pool, such as create, upgrade, and scale operations, can take longer than expected. You can inspect the progress of these operations and abort the latest running operation to regain control of the managed cluster or node pool. The commands in this article don't inspect or terminate Kubernetes workload deployments or processes running inside pods.
Use the az aks operation show-latest command to show the status of the latest operation on a managed cluster:
az aks operation show-latest \
--resource-group myResourceGroup \
--name myCluster
The following output is an example:
{
"endTime": null,
"error": null,
"id": "/subscriptions/<subscription-id>/resourcegroups/myResourceGroup/providers/Microsoft.ContainerService/managedClusters/contoso/operations/<operation-id>",
"name": "<operation-id>",
"operations": null,
"percentComplete": 1.0,
"resourceGroup": "myResourceGroup",
"resourceId": null,
"startTime": "2024-06-12T18:16:21+00:00",
"status": "InProgress"
}
The output includes the following operation details:
percentComplete: The reported completion percentage for the operation.startTime: The time when the operation started.status: The current operation status, such asInProgress.
Use the az aks operation show command and the operation ID from the preceding output to show a specific operation:
az aks operation show \
--resource-group myResourceGroup \
--name myCluster \
--operation-id "<operation-id>"
Allow operations to complete gracefully when possible. You can abort the latest operation before it reaches a terminal state if the operation is stuck or failing, or if you started it in error. The ability to abort the latest running operation is generally available through the Azure REST API and the Azure CLI.
Before you begin
- Azure CLI version 2.85.0 or later. Run
az --versionto find the version, and runaz upgradeto upgrade the version. If you need to install or upgrade, see Install Azure CLI. - The
aks-previewextension, which provides theaz aks operationcommands. The extension installs automatically the first time you run anaz aks operationcommand. To install it manually, runaz extension add --name aks-preview. If the extension is already installed, update it withaz extension update --name aks-preview.
Abort a long-running operation on AKS
Use az aks nodepool operation-abort to cancel the latest running operation on a node pool. Use az aks operation-abort to cancel the latest running operation on a managed cluster.
The following example cancels an operation on a node pool in a specified cluster:
az aks nodepool operation-abort \
--resource-group myResourceGroup \
--cluster-name myAKSCluster \
--name myNodePool
The following example cancels an operation on a specified cluster:
az aks operation-abort \
--name myAKSCluster \
--resource-group myResourceGroup
After AKS accepts the cancel request, the operation progresses through the following statuses:
| Operation status | Meaning |
|---|---|
Canceling |
AKS is canceling the operation. |
Canceled |
AKS finished canceling the operation. |
Use the following command to check the latest managed cluster operation:
az aks operation show-latest \
--resource-group myResourceGroup \
--name myAKSCluster
To check the latest operation on a node pool, include the --nodepool-name parameter:
az aks operation show-latest \
--resource-group myResourceGroup \
--name myAKSCluster \
--nodepool-name myNodePool
Canceling an operation doesn't by itself roll back changes that AKS applied before cancellation.
Next steps
For more information about monitoring the performance and health of your Kubernetes cluster and container workloads, see Container insights.