콘텐츠로 이동
Docs Try Aspire

Kubernetes integration

이 콘텐츠는 아직 번역되지 않았습니다.

Kubernetes logo

The Aspire Kubernetes hosting integration enables you to generate Kubernetes deployment manifests from your Aspire application model. This integration allows you to define your application’s infrastructure and deployment configuration using the familiar Aspire AppHost and then publish it as Kubernetes YAML manifests for deployment to any Kubernetes cluster.

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

Aspire CLI — Aspire.Hosting.Kubernetes 패키지 추가
aspire add kubernetes

Aspire CLI는 대화형입니다. 프롬프트 시 알맞은 검색 결과 선택:

Aspire CLI — 출력 예시
Select an integration to add:
> kubernetes (Aspire.Hosting.Kubernetes)
> Other results listed as selectable options...

After installing the package, add a Kubernetes environment to your AppHost project using the AddKubernetesEnvironment method:

C# — AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
var k8s = builder.AddKubernetesEnvironment("k8s");
var api = builder.AddProject<Projects.MyApi>("api");
builder.Build().Run();

Configure Kubernetes environment properties

Section titled “Configure Kubernetes environment properties”

You can customize the Kubernetes environment using the WithProperties method:

C# — AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
var api = builder.AddProject<Projects.MyApi>("api");
builder.AddKubernetesEnvironment("k8s")
.WithProperties(k8s =>
{
k8s.HelmChartName = "my-aspire-app";
});
builder.Build().Run();

The WithProperties method allows you to configure various aspects of the Kubernetes deployment, including the Helm chart name that will be used for generating the Kubernetes resources.

For a complete guide on generating Kubernetes Helm charts, deploying with Helm, resource mappings, and troubleshooting — see Deploy to Kubernetes.