Skip to content

Commit 687970f

Browse files
Merge pull request #233244 from Nickomang/aks-stop-api-upgrade
Added automatically stop upgrades on API breaking changes
2 parents e66331f + 9727e69 commit 687970f

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

articles/aks/upgrade-cluster.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,65 @@ The Azure portal also highlights all the deprecated APIs between your current ve
113113

114114
---
115115

116+
## Stop cluster upgrades automatically on API breaking changes (Preview)
117+
118+
[!INCLUDE [preview features callout](./includes/preview/preview-callout.md)]
119+
120+
To stay within a supported Kubernetes version, you usually have to upgrade your cluster at least once per year and prepare for all possible disruptions. These disruptions include ones caused by API breaking changes, deprecations, and dependencies such as Helm and CSI. It can be difficult to anticipate these disruptions and migrate critical workloads without experiencing any downtime.
121+
122+
AKS now automatically stops upgrade operations consisting of a minor version change if deprecated APIs are detected. This feature alerts you with an error message if it detects usage of APIs that are deprecated in the targeted version.
123+
124+
All of the following criteria must be met in order for the stop to occur:
125+
126+
* The upgrade operation is a Kubernetes minor version change for the cluster control plane
127+
128+
* The Kubernetes version you are upgrading to is 1.26 or later
129+
130+
* If performed via REST, the upgrade operation uses a preview API version of `2023-01-02-preview` or later
131+
132+
* If performed via Azure CLI, the `aks-preview` CLI extension 0.5.134 or later must be installed
133+
134+
* The last seen usage seen of deprecated APIs for the targeted version you are upgrading to must occur within 12 hours before the upgrade operation. AKS records usage hourly, so any usage of deprecated APIs within one hour isn't guaranteed to appear in the detection.
135+
136+
If all of these criteria are true when you attempt an upgrade, you'll receive an error message similar to the following example:
137+
138+
```output
139+
Bad Request({
140+
"code": "ValidationError",
141+
"message": "Control Plane upgrade is blocked due to recent usage of a Kubernetes API deprecated in the specified version. Please refer to https://kubernetes.io/docs/reference/using-api/deprecation-guide to migrate the usage. To bypass this error, set IgnoreKubernetesDeprecations in upgradeSettings.overrideSettings. Bypassing this error without migrating usage will result in the deprecated Kubernetes API calls failing. Usage details: 1 error occurred:\n\t* usage has been detected on API flowcontrol.apiserver.k8s.io.prioritylevelconfigurations.v1beta1, and was recently seen at: 2023-03-23 20:57:18 +0000 UTC, which will be removed in 1.26\n\n",
142+
"subcode": "UpgradeBlockedOnDeprecatedAPIUsage"
143+
})
144+
```
145+
146+
### Mitigating stopped upgrade operations
147+
148+
After receiving the error message, you have two options to mitigate the issue:
149+
150+
#### Remove usage of deprecated APIs (recommended)
151+
152+
To remove usage of deprecated APIs, follow these steps:
153+
154+
1. Remove the deprecated API, which is listed in the error message. Check the past usage by enabling [container insights][container-insights] and exploring kube audit logs.
155+
156+
2. Wait 12 hours from the time the last deprecated api usage was seen.
157+
158+
3. Retry your cluster upgrade.
159+
160+
#### Bypass validation to ignore API changes
161+
162+
To bypass validation to ignore API breaking changes, set the property `upgrade-settings` to `IgnoreKubernetesDeprecations`. You will need to use the `aks-preview` Azure CLI extension version 0.5.134 or later. This method is not recommended, as deprecated APIs in the targeted Kubernetes version may not work at all long term. It is advised to remove them as soon as possible after the upgrade completes.
163+
164+
```azurecli-interactive
165+
az aks update --name myAKSCluster --resource-group myResourceGroup --upgrade-settings IgnoreKubernetesDeprecations --upgrade-override-until 2023-04-01T13:00:00Z
166+
```
167+
168+
The `upgrade-override-until` property is used to define the end of the window during which validation will be bypassed. If no value is set, it will default the window to three days from the current time. The date and time you specify must be in the future.
169+
170+
> [!NOTE]
171+
> `Z` is the zone designator for the zero UTC/GMT offset, also known as 'Zulu' time. This example sets the end of the window to `13:00:00` GMT. For more information, see [Combined date and time representations](https://wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations).
172+
173+
After a successful override, performing an upgrade operation will ignore any deprecated API usage for the targeted version.
174+
116175
## Customize node surge upgrade
117176

118177
> [!IMPORTANT]
@@ -308,3 +367,4 @@ This article showed you how to upgrade an existing AKS cluster. To learn more ab
308367
[release-tracker]: release-tracker.md
309368
[specific-nodepool]: node-image-upgrade.md#upgrade-a-specific-node-pool
310369
[k8s-deprecation]: https://kubernetes.io/blog/2022/11/18/upcoming-changes-in-kubernetes-1-26/#:~:text=A%20deprecated%20API%20is%20one%20that%20has%20been,point%20you%20must%20migrate%20to%20using%20the%20replacement
370+
[container-insights]:/azure/azure-monitor/containers/container-insights-log-query#resource-logs

0 commit comments

Comments
 (0)