Skip to main content
net8.0

Azure Kubernetes Service (AKS) resource types for Aspire.

Published
Oct 20, 2026
3d ago
Total Downloads
4.3K
4,337

Install

dotnet add package Aspire.Hosting.Azure.Kubernetes --version 13.6.2-preview.1.26519.11
ProductVersions
.NET
net8.0

README

Azure Kubernetes Service hosting integration

Use this integration to model, configure, and orchestrate an Azure Kubernetes Service (AKS) environment in an Aspire solution.

Getting started

Prerequisites

Aspire shells out to helm upgrade --install to deploy the generated chart and any AddHelmChart(...) releases, and validates the Helm version up front so missing or older installs produce a clear actionable error instead of cryptic flag failures.

Add the integration

From your AppHost directory, add the Aspire.Hosting.Azure.Kubernetes integration with the Aspire CLI:

aspire add Aspire.Hosting.Azure.Kubernetes

Usage example

In the AppHost, add an AKS environment and deploy services to it:

C#

var aks = builder.AddAzureKubernetesEnvironment("aks");

var myService = builder.AddProject<Projects.MyService>()
    .WithComputeEnvironment(aks);

TypeScript

const aks = await builder.addAzureKubernetesEnvironment("aks");

const myService = await builder.addNodeApp("myService", "../my-service", "server.js")
    .withComputeEnvironment(aks);

Persistent volumes

Add a persistent volume to the AKS environment and mount it into a workload:

C#

var data = aks.AddPersistentVolume("data")
    .WithCapacity("20Gi");

myService.WithPersistentVolume(data, "/data", env: "DATA_PATH");

TypeScript

const data = await aks.addPersistentVolume("data");
await data.withCapacity("20Gi");

await myService.withKubernetesPersistentVolumeMount(data, "/data", { env: "DATA_PATH" });

When a project or executable runs locally, DATA_PATH points to a persistent directory in the AppHost's Aspire store. That store is normally under the AppHost intermediate-output directory, so cleaning build outputs can remove the local data. Local containers use a worktree-scoped container volume instead when the mount names an environment variable, and one persistent-volume resource cannot be shared between local containers and local projects or executables.

In AKS, DATA_PATH contains /data, the mounted volume path. When no storage class is specified, the generated claim uses the cluster's default storage class. A standard AKS cluster dynamically provisions an Azure managed disk. To request Premium SSD storage explicitly, call WithStorageClass("managed-csi-premium") in C# or withStorageClass("managed-csi-premium") in TypeScript.

Additional documentation

Feedback & contributing

https://github.com/microsoft/aspire

Changes from Previous Version

No structural changes between v13.6.1-preview.1.26506.6 and v13.6.2-preview.1.26519.11.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

This version is marked prerelease. Validate its API and upgrade path before production use.Compatibility metadata lists 1 target framework; confirm the exact target used by your application.The published metadata declares 50 direct dependency entries across framework groups. Inspect the resolved dependency graph for your target framework.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.