# AzureKubernetesEnvironmentResource

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

## Definition

```typescript
interface AzureKubernetesEnvironmentResource
  extends IAzureResource,
    IComputeEnvironmentResource,
    IResource,
    IResourceWithParameters,
    IAzureComputeEnvironmentResource,
    IAzureNspAssociationTarget {
  addCertManager(
      name: string,
      chartVersion?: string): CertManagerResource;
  addGateway(name: string): KubernetesGatewayResource;
  addHelmChart(
      name: string,
      chartReference: string,
      chartVersion: string): KubernetesHelmChartResource;
  addIngress(name: string): KubernetesIngressResource;
  addLoadBalancer(
      name: string,
      subnet: AzureSubnetResource): AzureKubernetesLoadBalancerResource;
  addNodePool(
      name: string,
      vmSize?: string,
      minCount?: number,
      maxCount?: number): AksNodePoolResource;
  withContainerRegistry(registry: AzureContainerRegistryResource): AzureKubernetesEnvironmentResource;
  withSubnet(subnet: AzureSubnetResource): AzureKubernetesEnvironmentResource;
  withSystemNodePool(
      vmSize?: string,
      minCount?: number,
      maxCount?: number): AzureKubernetesEnvironmentResource;
  withWorkloadIdentity(enabled?: boolean): AzureKubernetesEnvironmentResource;
}
```

## Methods

- [addCertManager](/reference/api/typescript/aspire.hosting.azure.kubernetes/azurekubernetesenvironmentresource/addcertmanager.md) -- `method` -- Installs cert-manager into an AKS environment
    ```typescript
  addCertManager(name: string, chartVersion?: string): CertManagerResource
  ```
- [addGateway](/reference/api/typescript/aspire.hosting.azure.kubernetes/azurekubernetesenvironmentresource/addgateway.md) -- `method` -- Adds a Kubernetes Gateway API Gateway resource to the application model, associated with the inner Kubernetes environment of the specified AKS environment.
    ```typescript
  addGateway(name: string): KubernetesGatewayResource
  ```
- [addHelmChart](/reference/api/typescript/aspire.hosting.azure.kubernetes/azurekubernetesenvironmentresource/addhelmchart.md) -- `method` -- Adds an external Helm chart to be installed in the AKS environment's inner Kubernetes environment. The chart is installed via `helm upgrade --install` as a pipeline step after the main application Helm chart is deployed.
    ```typescript
  addHelmChart(name: string, chartReference: string, chartVersion: string): KubernetesHelmChartResource
  ```
- [addIngress](/reference/api/typescript/aspire.hosting.azure.kubernetes/azurekubernetesenvironmentresource/addingress.md) -- `method` -- Adds a Kubernetes Ingress resource to the application model, associated with the inner Kubernetes environment of the specified AKS environment. The ingress generates a `networking.k8s.io/v1 Ingress` resource in the Helm chart output at publish time.
    ```typescript
  addIngress(name: string): KubernetesIngressResource
  ```
- [addLoadBalancer](/reference/api/typescript/aspire.hosting.azure.kubernetes/azurekubernetesenvironmentresource/addloadbalancer.md) -- `method` -- 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.
    ```typescript
  addLoadBalancer(name: string, subnet: AzureSubnetResource): AzureKubernetesLoadBalancerResource
  ```
- [addNodePool](/reference/api/typescript/aspire.hosting.azure.kubernetes/azurekubernetesenvironmentresource/addnodepool.md) -- `method` -- Adds a node pool to the AKS cluster.
    ```typescript
  addNodePool(name: string, vmSize?: string, minCount?: number, maxCount?: number): AksNodePoolResource
  ```
- [withContainerRegistry](/reference/api/typescript/aspire.hosting.azure.kubernetes/azurekubernetesenvironmentresource/withcontainerregistry.md) -- `method` -- Configures the AKS environment to use a specific Azure Container Registry for image storage. When set, this replaces the auto-created default container registry.
    ```typescript
  withContainerRegistry(registry: AzureContainerRegistryResource): AzureKubernetesEnvironmentResource
  ```
- [withSubnet](/reference/api/typescript/aspire.hosting.azure.kubernetes/azurekubernetesenvironmentresource/withsubnet.md) -- `method` -- Configures the AKS cluster to use a VNet subnet
    ```typescript
  withSubnet(subnet: AzureSubnetResource): AzureKubernetesEnvironmentResource
  ```
- [withSystemNodePool](/reference/api/typescript/aspire.hosting.azure.kubernetes/azurekubernetesenvironmentresource/withsystemnodepool.md) -- `method` -- Replaces the default system node pool with a customized configuration.
    ```typescript
  withSystemNodePool(vmSize?: string, minCount?: number, maxCount?: number): AzureKubernetesEnvironmentResource
  ```
- [withWorkloadIdentity](/reference/api/typescript/aspire.hosting.azure.kubernetes/azurekubernetesenvironmentresource/withworkloadidentity.md) -- `method` -- Enables or disables workload identity on the AKS environment, allowing pods to authenticate to Azure services using federated credentials.
    ```typescript
  withWorkloadIdentity(enabled?: boolean): AzureKubernetesEnvironmentResource
  ```
