Get started with the Kind integration

このコンテンツはまだ日本語訳がありません。

⭐ Community Toolkit

Kind, short for Kubernetes in Docker, runs Kubernetes clusters in containers. The Aspire Community Toolkit Kind integration lets your AppHost create a local Kind cluster, deploy Helm charts or Kubernetes manifests, and pass cluster credentials to other resources.

Use the integration to test Kubernetes operators and workloads during local development. It also provides a Kind-backed compute environment for Aspire’s publish and deploy commands.

  • Model the local cluster and its deployed resources in the AppHost.
  • View the cluster, Helm charts, and manifests alongside other resources in the Aspire dashboard.
  • Configure cluster lifetime so a cluster can either be removed at the end of a session or reused after an AppHost restart.
  • Use WithReference to pass the kubeconfig and cluster name to projects, executables, and containers.
  • Keep Kubernetes resources in local files or inline manifest content and make dependent resources wait for them.

How the integration fits into an Aspire app

Section titled “How the integration fits into an Aspire app”

The integration supports two workflows. In the development workflow, the AppHost manages a Kind cluster and optionally deploys resources into it. In the deployment workflow, a Kubernetes environment configured with Kind backs aspire publish and aspire deploy.

flowchart LR
    apphost[AppHost] --> cluster[Kind cluster]
    cluster --> manifests[Kubernetes manifests]
    cluster --> helm[Helm charts]
    cluster --> workload[Local project or container]
    environment[Kubernetes environment] --> kind[Kind compute target]
    kind --> publish[aspire publish or aspire deploy]

Kind runs its Kubernetes nodes as containers. Kind-managed workloads use Kubernetes networking inside the cluster, which is separate from Aspire’s container network. See Networking and references before connecting Aspire containers to cluster resources.

Install the tools needed for your workflow:

  • Docker or Podman to run Kind nodes as containers.
  • Kind CLI available on your PATH to create and delete the cluster.
  • kubectl CLI to add Helm charts or apply manifest resources.
  • Helm CLI to add Helm chart resources or use the Kind compute environment for deploy scenarios.

Install Docker or Podman, Kind, kubectl, and Helm.

Install the 📦 CommunityToolkit.Aspire.Hosting.Kind package in your AppHost, then add a cluster resource:

Aspire CLI — CommunityToolkit.Aspire.Hosting.Kind パッケージを追加
aspire add communitytoolkit-kind

Aspire CLI は対話的です。求められたら適切な結果を選択してください:

Aspire CLI — 出力例
Select an integration to add:
> communitytoolkit-kind (CommunityToolkit.Aspire.Hosting.Kind)
> Other results listed as selectable options...
apphost.mts
import { createBuilder } from './.aspire/modules/aspire.mjs';
const builder = await createBuilder();
await builder.addKindCluster('mycluster');
await builder.build().run();

The integration provisions the cluster when the AppHost starts. By default, it attempts to delete the cluster during graceful shutdown or when its lifecycle hook is disposed. Cleanup is best-effort.

  1. Configure the cluster and add workloads. Set the Kubernetes version, worker count, and lifetime, then add Helm charts or manifests if needed.
  2. Reference the cluster from an AppHost resource to provide its kubeconfig to the resource.
  3. Use the Aspire dashboard to inspect the cluster and the status of its chart and manifest resources.