How to update deprecated APIs for system agents in AKS?

imgkj 45 Reputation points
2024-03-21T14:40:35.9433333+00:00

I am trying to upgrade my aks cluster which is out of support running v1.21. While starting the upgrade I saw the warning that I need to change the deprecated APIs or else it could block the upgrade process. There were two system specific resources mentioned in the warning that need to upgrade -

User's image

User's image

How do I resolve this so that I am able to upgrade the AKS clusters to current versions. I need to make sure the upgrade is smooth and without any error.

Azure Kubernetes Service
Azure Kubernetes Service
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
2,447 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. KarishmaTiwari-MSFT 20,772 Reputation points Microsoft Employee Moderator
    2024-03-22T00:15:39.06+00:00

    @Gaurav Kumar Thanks for posting your query on Microsoft Q&A.

    Are you seeing an error like this?

    Bad Request({ "code": "ValidationError", "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 enable-force-upgrade 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", "subcode": "UpgradeBlockedOnDeprecatedAPIUsage" })

    You have two options to mitigate the issue. You can either remove usage of deprecated APIs (recommended) or bypass validation to ignore API changes.

    #1. Remove usage of deprecated APIs (recommended)

    -In the Azure portal, navigate to your cluster's overview page, and select Diagnose and solve problems.

    -Navigate to the Create, Upgrade, Delete, and Scale category, and select Kubernetes API deprecations.

    A screenshot of the Azure portal showing the 'Selected Kubernetes API deprecations' section.

    -Wait 12 hours from the time the last deprecated API usage was seen. Check the verb in the deprecated API usage to know if it's a watch.

    -Retry your cluster upgrade.

    -You can also check past API usage by enabling Container Insights and exploring kube audit logs. Check the verb in the deprecated API usage to understand if it's a watch use case.

    #2.Bypass validation to ignore API changes

    This method requires you to use the Azure CLI version 2.53 or later. If you have the aks-preview CLI extension installed, you'll need to update to version 0.5.154 or later. This method isn't recommended, as deprecated APIs in the targeted Kubernetes version may not work long term. We recommend removing them as soon as possible after the upgrade completes.

    Step by step process is described here: https://learn.microsoft.com/en-us/azure/aks/stop-cluster-upgrade-api-breaking-changes#bypass-validation-to-ignore-api-changes

    Additional Reading:

    -https://stackoverflow.com/questions/78122904/aks-upgrade-failed-due-to-usage-of-a-deprecated-api-but-i-dont-see-that-api-bei

    -https://kubernetes.io/docs/reference/using-api/api-concepts/#watching-resources

    -https://kubernetes.io/docs/reference/using-api/deprecation-guide/


    Hope that helps.

    If you have questions, please let me know in the "comments" and we would be happy to help you. Comment is the fastest way of notifying the experts.

    Please don’t forget to "Accept Answer" and hit Yes for "was this answer helpful" wherever the information provided helps you, this can be beneficial to other community members for remediation for similar issues.

    User's image


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.