You can create a new subnet with the desired subnet mask (for example, /24) within the same virtual network (VNet).
Update the AKS cluster to use the new subnet for node pools. This can be done by creating new node pools in the new subnet and gradually migrating workloads to these new node pools.
Make sure you have enough capacity to run your workloads during this migration.
Gradually drain and isolate nodes on the old subnet and move workloads to nodes on the new subnet.
Use the kubectl drain command to safely remove all pods from a node.
Update the cluster configuration:
After all workloads are migrated, update the cluster configuration to point to the new subnet.
You can Also reduce the cluster nodes to reserve IP addresses for the upgrade.
If scaling down isn't an option, and your virtual network CIDR has enough IP addresses, try to add a node pool that has a unique subnet:
- Add a new user node pool in the virtual network on a larger subnet.
- Switch the original node pool to a system node pool type.
- Scale up the user node pool.
- Scale down the original node pool.
https://learn.microsoft.com/en-us/azure/aks/scale-cluster?tabs=azure-cli
https://learn.microsoft.com/pt-br/azure/aks/configure-azure-cni?tabs=configure-networking-portal
Get in touch if you need more help with this issue.
--please don't forget to "[Accept the answer]" if the reply is helpful--