# addLoadBalancer

- Module: [Aspire.Hosting.Azure.Kubernetes](/reference/api/typescript/aspire.hosting.azure.kubernetes.md)
- Version: `13.4.0-preview.1.26281.18`
- Kind: `method`
- Source: [GitHub](https://github.com/microsoft/aspire)

Adds an Azure Application Gateway for Containers (AGC) `ApplicationLoadBalancer` to this AKS environment, bound to the supplied delegated subnet. Returns a resource builder that can be passed to `gateway.WithLoadBalancer(lb)` / `ingress.WithLoadBalancer(lb)` to route traffic through this load balancer.

## Definition

```typescript
interface AzureKubernetesEnvironmentResource {
  // ... omitted for brevity
  addLoadBalancer(
    name: string,
    subnet: AzureSubnetResource): AzureKubernetesLoadBalancerResource
}
```

## Parameters

- `name` (`string`)
- `subnet` (`AzureSubnetResource`)

## Returns

[AzureKubernetesLoadBalancerResource](/reference/api/typescript/aspire.hosting.azure.kubernetes/azurekubernetesloadbalancerresource.md) `builder`

## Applies to

- [AzureKubernetesEnvironmentResource](/reference/api/typescript/aspire.hosting.azure.kubernetes/azurekubernetesenvironmentresource.md)
