Azure API Issues with AKS

80 Views Asked by At

I am writing to raise some queries regarding our current usage of Azure CAF (Cloud Adoption Framework) modules, particularly in light of recent API issues we have encountered while trying to connect AKS kubernetes cluster via pipeline.

We have been experiencing difficulties with connecting to AKS cluster and upon investigation, we have identified that we have not specified any API version in the code to connect the cluster.

The error:

Error : retrieving Cluster: (Managed Cluster Name : XXXXXXXXX / resource Group "xxxxxxxxxx"): containerservice.ManagedClusterClient#Get: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned error. Status=400 Code: "NoRegisteredProviderFound" Message="No registered resource provider found for location 'uksouth' and API version '2022-01-02-preview' for type 'managedClusters'.

Currently we are using Azurerm 2.99

  • Will upgrading Azurerm to the latest version potentially resolve API issues (connecting with new available API) we are encountering?

  • Are there any compatibility considerations or risks associated with upgrading to the latest Azurerm version?

  • How should we proceed with testing and implementation to ensure a smooth transition and minimal disruption to our operations?

1

There are 1 best solutions below

0
Arko On

The error message indicates that the Azure Resource Provider for the AKS (Azure Kubernetes Service) service, specifically for the version '2022-01-02-preview', is not registered in your Azure subscription for the 'uksouth' location.

Register

az provider register --namespace Microsoft.ContainerService

enter image description here

and verify the same using az provider show --namespace Microsoft.ContainerService --query "registrationState"

enter image description here

The specific API version '2022-01-02-preview' might not be available in your region. While upgrading the AzureRM provider can often resolve these types of issues by aligning with the supported API versions, it's also possible that the error is due to a regional limitation or an incorrect API version. To check the available API versions for the Microsoft.ContainerService resource provider, you can use:

az provider show --namespace Microsoft.ContainerService --query "resourceTypes[?resourceType=='managedClusters'].apiVersions[]" -o tsv

enter image description here

If a different API version is needed, you might have to adjust your Terraform configuration.

Upgrading to the latest version of Azurerm may potentially resolve the API issues you are encountering. However, upgrading AzureRM could introduce breaking changes. You should review the release notes of the AzureRM provider to understand any new features, fixes, and breaking changes introduced since version 2.99. There may be compatibility considerations or risks associated with upgrading to the latest version. It is recommended to review the release notes for the latest version of Azurerm to ensure compatibility with your current environment and to test the upgrade in a non-production environment before implementing it in your production environment.

If a different API version is needed, you might have to adjust your Terraform configuration. If you want, you can even pin the provider version to avoid unexpected changes. This practice ensures that your configurations are tied to a specific version of the provider, reducing the likelihood of an unexpected behavior change. example-

terraform {
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "~> 3.95.0"  # Replace with the desired version
    }
  }
}

enter image description here

Refer to azurerm 3.95 release notes