-
Notifications
You must be signed in to change notification settings - Fork 163
Description
Summary
I'd like to propose adding an Aspire.Hosting.Kind integration resource that enables provisioning and managing local Kubernetes clusters using Kind (Kubernetes IN Docker) from within .NET Aspire application host code.
Motivation
Kind is the standard tool for running local Kubernetes clusters for development and CI/CD pipelines. Aspire already has excellent integrations for containers and cloud services, but there's currently no first-class way to spin up a local Kubernetes cluster as part of an Aspire app host. This gap means developers who want to test their apps on Kubernetes locally have to set up and manage Kind clusters manually, outside the Aspire lifecycle.
An Aspire.Hosting.Kind resource would:
- Let developers declare a local k8s cluster as part of their Aspire app host
- Automatically create/delete the Kind cluster with the app lifecycle
- Support deploying Kubernetes manifests (Deployments, Services, ConfigMaps, etc.) onto the cluster
- Integrate with Aspire's health checks, dashboard, and resource model
- Simplify local k8s development for teams already using Aspire
Proposed API
var builder = DistributedApplication.CreateBuilder(args);
var cluster = builder.AddKindCluster("my-cluster")
.WithKubernetesVersion("v1.30.0");
cluster.AddDeployment("api-deployment", "manifests/api-deployment.yaml");
cluster.AddService("api-service", "manifests/api-service.yaml");
builder.Build().Run();Implementation
A working implementation already exists in the tamirdresher/aspire-kind repository. It includes:
KindClusterResource— core Aspire resource implementingIResourceWithConnectionStringKindClusterLifecycleHook—IDistributedApplicationLifecycleHookthat creates/destroys the clusterKindClusterExtensions— fluent API extension methods (AddKindCluster,AddDeployment,AddService, etc.)KubernetesManifestResource— child resource representing k8s manifests deployed to the cluster- Full integration tests using
DistributedApplicationTestingBuilder - XML documentation and usage samples
The implementation uses the kind CLI (must be installed) and wraps it via CliWrap. It was tested on Linux and Windows.
Prior Art / Related
- Aspire.Hosting.Docker — similar pattern for Docker resources
- Aspire's container model uses a similar lifecycle pattern for container resources
Contribution Plan
If maintainers are open to this, I am happy to:
- Fork and adapt the implementation to match CommunityToolkit conventions
- Add tests following the project's test patterns
- Write samples following the existing sample structure
- Submit a PR with full documentation
Co-authored with Andrey Noskov.
Questions for Maintainers
- Is this the kind of resource the CommunityToolkit/Aspire project is interested in hosting?
- Should we align the API with any existing conventions I may have missed?
- Any concerns about requiring
kindCLI as a prerequisite (similar to Docker CLI dependency)?
Happy to discuss and iterate before submitting a PR.