Unable to delete kubernetes loadbalancer, aksOutboundBackendPool are in use by virtual machine scale set

Mike 10 Reputation points
2023-01-12T08:49:52.6933333+00:00

I am trying to delete a kubernetes loadbalancer (created from an AKS cluster that no longer exist). This results in the following error:

Failed to delete load balancer 'kubernetes'. Error: Cannot delete load balancer mc_jollybush-xxxxxxxx-rg_jollybush-xxxxxxxx_westeurope/providers/Microsoft.Network/loadBalancers/kubernetes'>kubernetes since its child resources kubernetes,aksOutboundBackendPool are in use by virtual machine scale set /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/MC_jollybush-xxxxxxxx-rg_jollybush-xxxxxxxx_westeurope/providers/Microsoft.Compute/virtualMachineScaleSets/aks-agentpool-28130424-vmss.

However this virtual machine scale set does not exists.

Is it posible to force delete this loadbalancer?

Or force delete this resource group?

Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
1,866 questions
Azure Load Balancer
Azure Load Balancer
An Azure service that delivers high availability and network performance to applications.
404 questions
Azure Virtual Machine Scale Sets
Azure Virtual Machine Scale Sets
Azure compute resources that are used to create and manage groups of heterogeneous load-balanced virtual machines.
348 questions
{count} vote

4 answers

Sort by: Most helpful
  1. Andrei Barbu 2,576 Reputation points Microsoft Employee
    2023-01-12T09:04:29.88+00:00

    Hello Mike!

    Could you please try to check and see if you have access to mc_jollybush-xxxxxxxx-rg_jollybush-xxxxxxxx_westeurope/providers/Microsoft.Network/loadBalancers/kubernetes from [https://resources.azure.com/?

    If yes, please try to remove the reference to aks-agentpool-28130424-vmss.

    To be able to perform changes, at resources.azure.com level, please switch to "Read/Write" -> select the "kubernetes" LB -> remove the reference from the JSON -> PUT. After this, try again to remove the kubernetes LB.

    Please "Accept as Answer" and Upvote if it helped, so that it can help others in the community looking for help on similar topics.

    Thank you!


  2. Adrian Dobrescu 261 Reputation points Microsoft Employee
    2023-01-12T09:09:50.5466667+00:00

    Hello Mike,

    If you go to load balancer under MC resource group - outbound rules -you can try to delete the aksoutboundrule then try again delete load balancer itself.

    lb

    Hope it helps.

    Please "Accept as Answer" if it helped and Upvote, so that it can help others in the community looking for help on similar topics.

    Thank you


  3. Manuel 0 Reputation points
    2023-09-22T20:12:36.2966667+00:00

    Hi I have the same problem, a load balancer which was created from a Kubernetes deployment and can no longer be deleted due to orphaned machine scale set.

    I tried the step from Andrei but didn't get any further with it. Does anyone have another idea how I can delete the load balancer?

    Failed to delete load balancer 'kubernetes'. Error: Cannot delete load balancer MC_thankfuldune-c1515963-rg_thankfuldune-c1515963_westeurope/providers/Microsoft.Network/loadBalancers/kubernetes'>kubernetes since its child resources kubernetes,aksOutboundBackendPool,gfadgad are in use by virtual machine scale set /subscriptions/xxxxxxxxx/resourceGroups/MC_thankfuldune-c1515963-rg_thankfuldune-c1515963_westeurope/providers/Microsoft.Compute/virtualMachineScaleSets/aks-systempool-27307886-vmss.

    Thank You

    0 comments No comments

  4. AlaaBarqawi_MSFT 782 Reputation points Microsoft Employee
    2023-10-15T08:53:44.8033333+00:00

    Hi @Mike @Manuel please do the following

    Remove load balancer associated with the VMSS:
    az vmss update --resource-group <<RESOURCE_GROUP_NAME>> --name <<VMSS_NAME>> --remove virtualMachineProfile.networkProfile.networkInterfaceConfigurations[0].ipConfigurations[0].loadBalancerBackendAddressPools 0

    Upgrade instances in the VMSS:
    az vmss update-instances --instance-ids "*" -n <<VMSS_NAME>> -g <<RESOURCE_GROUP_NAME>>

    Remove the load balancer:
    az network lb delete -g <<RESOURCE_GROUP_NAME>> -n <<LB_NAME>>

    I had success with this steps.

    0 comments No comments