Troubleshooting
Scenario 1: Namespace cb-ai-service stacked in the Terminating state
Symptoms
terraform destroy command is aborted.
Additional information
kubectl.exe describe namespace cb-ai-service

Name: cb-ai-service

Labels: app.kubernetes.io/managed-by=terraform

environment=development

kubernetes.io/metadata.name=cb-ai-service

Annotations: <none>

Status: Terminating

Conditions:

Type Status LastTransitionTime Reason Message

---- ------ ------------------ ------ -------

NamespaceDeletionDiscoveryFailure False Mon, 09 Mar 2026 17:25:52 +0200 ResourcesDiscovered All resources successfully discovered

NamespaceDeletionGroupVersionParsingFailure False Mon, 09 Mar 2026 17:25:52 +0200 ParsedGroupVersions All legacy kube types successfully parsed

NamespaceDeletionContentFailure False Mon, 09 Mar 2026 17:25:52 +0200 ContentDeleted All content successfully deleted, may be waiting on finalization

NamespaceContentRemaining True Mon, 09 Mar 2026 17:25:57 +0200 SomeResourcesRemain Some resources are remaining: services. has 1 resource instances

NamespaceFinalizersRemaining True Mon, 09 Mar 2026 17:25:57 +0200 SomeFinalizersRemain Some content in the namespace has finalizers remaining: service.kubernetes.io/load-balancer-cleanup in 1 resource instances
Explanation
AKS namespace stuck in terminating because of a finalizer on a LoadBalancer service.
service.kubernetes.io/load-balancer-cleanup
This is common on Azure Kubernetes Service. The LoadBalancer resource in Azure fails or hangs, so Kubernetes cannot remove the finalizer and namespace deletion is stalled.
Resolution
Perform the following steps.
1. Find the stuck service.
kubectl get svc -n cb-ai-service

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
cb-ai-service LoadBalancer 10.0.7.210 10.1.1.100 8000:30094/TCP 5d4h
2. Open the yaml file for cb-ai-service.
kubectl edit svc cb-ai-service -n cb-ai-service -o yaml
3. In cb-ai-service yaml file, delete the finalizers section. Save and close the file editor.
4. Rerun Terraform destroy command.
terraform destroy -var-file <var-file>
Was this helpful?