|
| 1 | +--- |
| 2 | +title: AKS cluster upgrade fails with UnsatisfiablePDB error |
| 3 | +description: Provides solutions to the UnsatisfiablePDB error when you try to upgrade an Azure Kubernetes Service (AKS) cluster. |
| 4 | +ms.date: 10/27/2023 |
| 5 | +ms.reviewer: chiragpa, v-weizhu |
| 6 | +ms.service: azure-kubernetes-service |
| 7 | +ms.custom: sap:Create, Upgrade, Scale and Delete operations (cluster or nodepool) |
| 8 | +#Customer intent: As an Azure Kubernetes Services (AKS) user, I want to troubleshoot an Azure Kubernetes Service cluster upgrade that failed because of a UnsatisfiablePDB error so that I can upgrade the cluster successfully. |
| 9 | +--- |
| 10 | + |
| 11 | +# Error "UnsatisfiablePDB" when upgrading an AKS cluster |
| 12 | + |
| 13 | +This article discusses how to identify and resolve the "UnsatisfiablePDB" error that might occur when you try to [upgrade an Azure Kubernetes Service (AKS) cluster](/azure/aks/upgrade-aks-cluster). |
| 14 | + |
| 15 | +## Prerequisites |
| 16 | + |
| 17 | +This article requires Azure CLI version 2.53.0 or a later version. Run `az --version` to find your installed version. If you need to install or upgrade the Azure CLI, see [How to install the Azure CLI](/cli/azure/install-azure-cli). |
| 18 | + |
| 19 | +## Symptoms |
| 20 | + |
| 21 | +An AKS cluster upgrade operation fails with the following error message: |
| 22 | + |
| 23 | +> Code: UnsatisfiablePDB |
| 24 | +> Message: 1 error occurred: |
| 25 | +> \* PDB \<pdb-namespace>/\<pdb-name> has maxunavailble == 0 can't proceed with put operation |
| 26 | +
|
| 27 | +## Cause |
| 28 | + |
| 29 | +Before starting an upgrade operation, AKS checks the cluster for any existing [Pod Disruption Budgets (PDBs)](https://kubernetes.io/docs/concepts/workloads/pods/disruptions/#pod-disruption-budgets) that have the `maxUnavailable` parameter set to 0. Such PDBs are likely to block node drain operations. If node drain operations are blocked, the cluster upgrade operation can't complete successfully. This might potentially cause the cluster to be in a failed state. |
| 30 | + |
| 31 | +After receiving the "UnsatisfiablePDB" error, you can confirm the PDB's status by running the following command: |
| 32 | + |
| 33 | +```console |
| 34 | +$ kubectl get pdb <pdb-name> -n <pdb-namespace> |
| 35 | +``` |
| 36 | + |
| 37 | +The output of this command should be similar to the following one: |
| 38 | + |
| 39 | +```output |
| 40 | +NAME MIN AVAILABLE MAX UNAVAILABLE ALLOWED DISRUPTIONS AGE |
| 41 | +<pdb-name> N/A 0 0 49s |
| 42 | +``` |
| 43 | + |
| 44 | +If the value of `MAX UNAVAILABLE` is 0, the node drain fails during the upgrade process. |
| 45 | + |
| 46 | +To resolve this issue, use one of the following solutions. |
| 47 | + |
| 48 | +## Solution 1: Adjust the PDB's "maxUnavailable" parameter |
| 49 | + |
| 50 | +> [!NOTE] |
| 51 | +> Use this solution if you can edit the PDB resource directly. |
| 52 | +
|
| 53 | +1. Set the PDB's `maxUnavailable` parameter to `1` or a greater value. For more information, see [Specifying a PodDisruptionBudget](https://kubernetes.io/docs/tasks/run-application/configure-pdb/#specifying-a-poddisruptionbudget). |
| 54 | +2. Retry the AKS cluster upgrade operation. |
| 55 | + |
| 56 | +## Solution 2: Back up, delete, and redeploy the PDB |
| 57 | + |
| 58 | +> [!NOTE] |
| 59 | +> Use this solution if directly editing the PDB resource isn't viable. |
| 60 | +
|
| 61 | +1. Back up the PDB using the following command: |
| 62 | + |
| 63 | + ```console |
| 64 | + $ kubectl get pdb <pdb-name> -n <pdb-namespace> -o yaml > pdb_backup.yaml |
| 65 | + ``` |
| 66 | + |
| 67 | +2. Delete the PDB using the following command: |
| 68 | + |
| 69 | + ```console |
| 70 | + $ kubectl delete pdb <pdb-name> -n <pdb-namespace> |
| 71 | + ``` |
| 72 | + |
| 73 | +3. Retry the AKS cluster upgrade operation. |
| 74 | + |
| 75 | +4. If the AKS cluster upgrade operation succeeds, redeploy the PDB using the following command: |
| 76 | + |
| 77 | + ```console |
| 78 | + $ kubectl apply -f pdb_backup.yaml |
| 79 | + ``` |
| 80 | + |
| 81 | +[!INCLUDE [Azure Help Support](../../../includes/azure-help-support.md)] |
0 commit comments