Aspire

Deploy to Kubernetes

Use aspire publish or aspire deploy to take your Aspire application to Kubernetes. Aspire uses the Kubernetes-targeted environments in your AppHost to determine how each compute resource maps to Kubernetes objects, then generates Helm charts or provisions infrastructure depending on the target you choose.

To understand how Aspire deployment works across all targets, see the Deployment overview.

Aspire supports two Kubernetes deployment targets:

When you publish or deploy, Aspire translates your application model into Kubernetes-native resources:

Aspire resourceKubernetes resource
Project resourcesDeployments or StatefulSets
Container resourcesDeployments or StatefulSets
Connection stringsConfigMaps and Secrets
Environment variablesConfigMaps and Secrets
EndpointsServices
VolumesPersistentVolumes and PersistentVolumeClaims

For durable storage that you model as first-class resources and bind to workloads, see Persistent volumes on Kubernetes.

For per-container scheduling reservations and runtime caps on either Kubernetes target, see Configure CPU and memory requests and limits. The sample uses the C# AppHost workload customization API.

Both Kubernetes targets support aspire publish. The key difference is whether the target also supports aspire deploy:

Targetaspire publishaspire deploy
KubernetesGenerates Helm charts you apply with helm or CIDeploys to the current kubectl context using helm install
AKSGenerates Helm charts and Bicep infrastructureProvisions Azure resources and deploys in a single command

For more on the pipeline model and how publish and deploy relate, see Pipelines and app topology.

Assign a container registry to a project or Dockerfile-backed resource to include its registry-qualified image name in the published Helm chart:

TypeScript — apphost.ts
const registry = await builder.addContainerRegistry("registry", "registry.example.com", "apps");
const api = await builder.addNodeApp("api", "../api", "server.js");
await api.withContainerRegistry(registry);

For this example, aspire publish writes registry.example.com/apps/api:latest to the image parameter in values.yaml:

YAML — values.yaml
parameters:
api:
api_image: "registry.example.com/apps/api:latest"

Image push options that customize the remote image name or tag are also respected. Existing container images, such as redis:7, are unchanged.

Literal registry values and non-secret parameter defaults are resolved during publishing. Registry values that require provisioning, secrets, or parameters without defaults remain deferred, and the published placeholder is <resource>:latest. aspire deploy resolves the image names again after provisioning and supplies them through a Helm values override file. If you deploy the published chart yourself, supply the deferred image values to Helm.