Skip to content
Docs Try Aspire
Docs Try

AzureKubernetesLoadBalancerResource

Class sealed net8.0
📦 Aspire.Hosting.Azure.Kubernetes v13.4.0-preview.1.26281.18
Represents a single Azure Application Gateway for Containers (AGC) ApplicationLoadBalancer Kubernetes custom resource ( alb.networking.azure.io/v1) bound to a delegated subnet.
namespace Aspire.Hosting.Azure.Kubernetes;
public sealed class AzureKubernetesLoadBalancerResource
: Aspire.Hosting.ApplicationModel.Resource,
Aspire.Hosting.ApplicationModel.IResource,
Aspire.Hosting.ApplicationModel.IResourceWithParent,
Aspire.Hosting.ApplicationModel.IResourceWithParent<Aspire.Hosting.Azure.Kubernetes.AzureKubernetesEnvironmentResource>
{
// ...
}
ResourceIResourceIResourceWithParentIResourceWithParent<AzureKubernetesEnvironmentResource>

Each AGC ApplicationLoadBalancer is capped at 5 frontends, so larger applications create multiple load balancer resources via repeated calls to AzureKubernetesEnvironmentExtensions.AddLoadBalancer and associate gateways/ingresses with a specific load balancer using AzureKubernetesIngressExtensions.WithLoadBalancer.

The resource registers a per-LB apply-alb-crd-{name} pipeline step that runs after AKS credentials are fetched and before Helm chart preparation. The step polls the cluster for the azure-alb-external GatewayClass (installed by the AGC ALB controller add-on), then kubectl apply s the ApplicationLoadBalancer custom resource pointing at the supplied subnet.