Resize AKS managed subnet

Tobias Babin 61 Reputation points
2023-06-01T06:26:37.95+00:00

Due to IP address range conflicts, we would like to change the CIDR range of the subnet of our AKS cluster.

The cluster VNet and its subnet are both Azure-managed. The cluster is using VMSS node pools.

Changing the subnet CIDR directly fails with the message "Subnet aks-xxxx is in use and cannot be updated", regardless of whether the cluster is running or stopped.

We created a new subnet in the same VNet using the desired CIDR range and tried to create a new node pool in that VNet, inspired by this solution and using the az aks nodepool add --vnet-subnet-id flag.

This yields the message "Cannot use a custom subnet because agent pool system is using a managed subnet. Please omit the vnetSubnetID parameter from the request."

So it appears the solution only works using a self-managed VNet, leaving us stuck for now.

Is there a way to work around this without recreating the cluster?

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,457 questions
0 comments No comments
{count} votes

Accepted answer
  1. Akram Kathimi 1,281 Reputation points Microsoft Employee
    2023-06-01T08:06:04.5233333+00:00

    Hi @Tobias Babin ,

    Recreating a new cluster is the straight forward way to go around this. However, there is a workaround that you might want to try:

    1- Stop the AKS cluster

    2- Delete all the VMSS (nodepools) from the MC resource group. (to release all the attached NICs from the subnet)

    3- Delete the old subnet

    4- Create a new subnet with the same name as the old subnet and a different IP range.

    5- Start the cluster

    Please Accept the answer if the information helped you. This will help us and others in the community as well.

    Thanks.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

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.