KindClusterResourceBuilderExtensions Methods
ClassMethods8 members
Extension methods for adding Kind cluster resources to the distributed application builder.
AddKindCluster(IDistributedApplicationBuilder, string) Section titled AddKindCluster(IDistributedApplicationBuilder, string)extensionIResourceBuilder<KindClusterResource> Adds a Kind cluster resource to the application model.
public static class KindClusterResourceBuilderExtensions{ public static IResourceBuilder<KindClusterResource> AddKindCluster( this IDistributedApplicationBuilder builder, string name) { // ... }}Parameters
builderIDistributedApplicationBuilder The Hosting.IDistributedApplicationBuilder .namestringThe name of the Kind cluster.Returns
IResourceBuilder<KindClusterResource> A reference to the ApplicationModel.IResourceBuilder`1 .WithClusterLifetime(IResourceBuilder<T>, ClusterLifetime) Section titled WithClusterLifetime(IResourceBuilder<T>, ClusterLifetime)extensionIResourceBuilder<T> Sets the cluster lifetime. When
ClusterLifetime.Session (the default), the cluster is deleted on graceful shutdown or other process-exit signals on a best-effort basis. When ClusterLifetime.Persistent , the cluster survives AppHost restarts and is reused on next startup. public static class KindClusterResourceBuilderExtensions{ public static IResourceBuilder<T> WithClusterLifetime<T>( this IResourceBuilder<T> builder, ClusterLifetime lifetime) { // ... }}Parameters
builderIResourceBuilder<T> The resource builder.lifetimeClusterReturns
IResourceBuilder<T> A reference to the ApplicationModel.IResourceBuilder`1 .WithKindConfig(IResourceBuilder<KindClusterResource>, Action<KindConfigModel>) Section titled WithKindConfig(IResourceBuilder<KindClusterResource>, Action<KindConfigModel>)extensionIResourceBuilder<KindClusterResource> Customizes the Kind cluster configuration. The callback receives the
KindConfigModel after default nodes have been populated, allowing arbitrary modifications before serialization to YAML. public static class KindClusterResourceBuilderExtensions{ public static IResourceBuilder<KindClusterResource> WithKindConfig( this IResourceBuilder<KindClusterResource> builder, Action<KindConfigModel> configure) { // ... }}Parameters
builderIResourceBuilder<KindClusterResource> The resource builder.configureAction<KindConfigModel> A callback to customize the Kind configuration model.Returns
IResourceBuilder<KindClusterResource> A reference to the ApplicationModel.IResourceBuilder`1 .Remarks
Multiple calls to this method compose: each callback is applied in order during config generation.
WithKubernetesVersion(IResourceBuilder<T>, string) Section titled WithKubernetesVersion(IResourceBuilder<T>, string)extensionIResourceBuilder<T> Sets the Kubernetes version for the Kind cluster.
public static class KindClusterResourceBuilderExtensions{ public static IResourceBuilder<T> WithKubernetesVersion<T>( this IResourceBuilder<T> builder, string version) { // ... }}Parameters
builderIResourceBuilder<T> The resource builder.versionstringThe Kubernetes version (e.g., "v1.32.2").Returns
IResourceBuilder<T> A reference to the ApplicationModel.IResourceBuilder`1 .WithNodeImage(IResourceBuilder<T>, string) Section titled WithNodeImage(IResourceBuilder<T>, string)extensionIResourceBuilder<T> Sets the Kind node image for every node in the cluster.
public static class KindClusterResourceBuilderExtensions{ public static IResourceBuilder<T> WithNodeImage<T>( this IResourceBuilder<T> builder, string image) { // ... }}Parameters
builderIResourceBuilder<T> The resource builder.imagestring The fully qualified Kind node image, such as kindest/node:v1.33.1 . This overrides the image that would otherwise be derived from KindClusterResourceBuilderExtensions.WithKubernetesVersion . Returns
IResourceBuilder<T> A reference to the ApplicationModel.IResourceBuilder`1 .WithNodeMount(IResourceBuilder<T>, string, string, bool) Section titled WithNodeMount(IResourceBuilder<T>, string, string, bool)extensionIResourceBuilder<T> Adds an extra host mount to every Kind node container.
public static class KindClusterResourceBuilderExtensions{ public static IResourceBuilder<T> WithNodeMount<T>( this IResourceBuilder<T> builder, string hostPath, string containerPath, bool readOnly = false) { // ... }}Parameters
builderIResourceBuilder<T> The resource builder.hostPath string The path on the host. Relative paths are resolved against the AppHost directory before being written to the Kind config. containerPath stringThe absolute path inside the Kind node container.readOnly booloptionaltrue to mount the path read-only.Returns
IResourceBuilder<T> A reference to the ApplicationModel.IResourceBuilder`1 .Remarks
This configures Kind node-container mounts, which are useful for surfacing host-side assets such as local manifest directories, certificates, or other development-time inputs to workloads that later mount paths from the node filesystem.
WithReference(IResourceBuilder<T>, IResourceBuilder<KindClusterResource>) Section titled WithReference(IResourceBuilder<T>, IResourceBuilder<KindClusterResource>)extensionIResourceBuilder<T> Configures a non-container resource to reference the Kind cluster by injecting kubeconfig environment variables.
public static class KindClusterResourceBuilderExtensions{ public static IResourceBuilder<T> WithReference<T>( this IResourceBuilder<T> builder, IResourceBuilder<KindClusterResource> kind) { // ... }}Parameters
builderIResourceBuilder<T> The resource builder.kindIResourceBuilder<KindClusterResource> The Kind cluster resource builder.Returns
IResourceBuilder<T> A reference to the ApplicationModel.IResourceBuilder`1 .Remarks
This overload sets KUBECONFIG to the host kubeconfig path, which is appropriate for resources that execute on the host (e.g., executables, projects).
For container resources, use the Kind overload instead, which handles container-specific requirements like bind-mounting and network connectivity.
WithWorkerNodes(IResourceBuilder<T>, int) Section titled WithWorkerNodes(IResourceBuilder<T>, int)extensionIResourceBuilder<T> Sets the number of worker nodes for the Kind cluster.
public static class KindClusterResourceBuilderExtensions{ public static IResourceBuilder<T> WithWorkerNodes<T>( this IResourceBuilder<T> builder, int count) { // ... }}Parameters
builderIResourceBuilder<T> The resource builder.countintThe number of worker nodes. Must be zero or greater.Returns
IResourceBuilder<T> A reference to the ApplicationModel.IResourceBuilder`1 .