Kubernetes is a supported deployment target for Aspire applications. By adding the Kubernetes hosting integration to your AppHost, you can use aspire publish to generate a complete set of Helm chart artifacts ready for deployment to any Kubernetes cluster.
To generate Kubernetes deployment artifacts from your Aspire application, run the aspire publish command:
Generate Kubernetes artifacts
aspirepublish-ok8s-artifacts
This command analyzes your application model and produces a complete Helm chart in the specified output directory. The generated chart structure looks like this:
Directoryk8s-artifacts/
Chart.yamlChart metadata (name, version, etc.)
values.yamlConfigurable values for the chart
Directorytemplates/
Directory<resource>/
deployment.yamlDeployment or StatefulSet
service.yamlService for connectivity
configmap.yamlConfiguration data
secret.yamlSensitive data
The publisher generates the following Kubernetes resources from your application model:
Deployments or StatefulSets for your application services
Services for network connectivity between resources
ConfigMaps for application configuration and connection strings
Secrets for sensitive data such as passwords and connection strings
Dockerfiles copied into the output directory for container build contexts
The publisher generates parameterized Helm values for container image references. If you haven’t specified custom container images, the generated values.yaml contains placeholders that you override at deployment time using --set or a custom values file.
Use the PublishAsKubernetesService callback to modify the generated Kubernetes resources for individual services. This provides fully typed access to the Kubernetes object model:
If your application can’t find connection strings at runtime, verify that the generated ConfigMaps and Secrets are correctly mounted as environment variables in your pod specifications. Check that the resource names in your Helm values match the expected connection string names.
Kubernetes Secrets store values as base64-encoded strings. Verify that your Secrets are properly encoded and that the generated templates reference them correctly. Use kubectl get secret <name> -o yaml to inspect Secret contents.
In Kubernetes, services discover each other using the cluster’s built-in DNS. A service named api is reachable at api.<namespace>.svc.cluster.local. The generated Helm charts configure service references automatically using Kubernetes-native DNS resolution.