Lewati ke konten
Docs Try Aspire
Docs Try

Azure Kubernetes Service (AKS) integration

Konten ini belum tersedia dalam bahasa Anda.

The Aspire AKS hosting integration enables you to deploy your Aspire application to Azure Kubernetes Service (AKS) with full provisioning. Aspire creates the AKS cluster, Azure Container Registry (ACR), managed identity, and any Azure resources your app depends on — all from your AppHost definition.

To get started with the Aspire AKS hosting integration, install the 📦 Aspire.Hosting.Azure.Kubernetes NuGet package in the AppHost project:

Aspire CLI — Tambahkan paket Aspire.Hosting.Azure.Kubernetes
aspire add azure-kubernetes

Aspire CLI interaktif; pilih hasil pencarian yang sesuai saat diminta:

Aspire CLI — Contoh keluaran
Select an integration to add:
> azure-kubernetes (Aspire.Hosting.Azure.Kubernetes)
> Other results listed as selectable options...

After installing the package, add an AKS environment to your AppHost:

AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
var aks = builder.AddAzureKubernetesEnvironment("aks");
var api = builder.AddProject<Projects.MyApi>("api");
builder.Build().Run();

When an AKS environment is present, all compute resources are automatically deployed to AKS — no additional opt-in is required.

Customize the system node pool VM size and scaling using WithSystemNodePool:

AppHost.cs
builder.AddAzureKubernetesEnvironment("aks")
.WithSystemNodePool("Standard_D4s_v5", minCount: 1, maxCount: 5);

Add additional node pools for workload isolation, GPU workloads, or specialized hardware requirements:

AppHost.cs
var aks = builder.AddAzureKubernetesEnvironment("aks");
var gpuPool = aks.AddNodePool("gpupool", "Standard_NC6s_v3", minCount: 0, maxCount: 5);
builder.AddContainer("ml-worker", "my-ml-image")
.WithNodePool(gpuPool);

The AKS integration supports both aspire publish (generate Helm chart and Bicep artifacts) and aspire deploy (provision Azure infrastructure and deploy in a single command).

For a complete end-to-end walkthrough, see Deploy to AKS.