Skip to content
DocsTry Aspire
DocsTry

K3sBuilderExtensions

Classstaticnet10.0
📦 CommunityToolkit.Aspire.Hosting.K3s v13.4.1-beta.706
Provides extension methods for adding k3s cluster resources to an Hosting.IDistributedApplicationBuilder.
namespace Aspire.Hosting;
public static class K3sBuilderExtensions
{
// ...
}
AddK3sCluster(IDistributedApplicationBuilder, string, int?, int?)extensionats export
IResourceBuilder<K3sClusterResource>
Adds a k3s Kubernetes cluster to the distributed application.
WithAgentCount(IResourceBuilder<K3sClusterResource>, int)extensionats export
IResourceBuilder<K3sClusterResource>
Sets the number of k3s agent (worker) nodes to add to the cluster.
WithDataVolume(IResourceBuilder<K3sClusterResource>, string?)extensionats export
IResourceBuilder<K3sClusterResource>
Mounts a named Docker volume at the k3s data directory so cluster state persists across AppHost restarts.
WithDisabledComponent(IResourceBuilder<K3sClusterResource>, string)extensionats export
IResourceBuilder<K3sClusterResource>
Disables a built-in k3s component ( --disable=<component>).
WithExtraArg(IResourceBuilder<K3sClusterResource>, string)extensionats export
IResourceBuilder<K3sClusterResource>
Appends a raw argument to the k3s server command line.
WithHelmImage(IResourceBuilder<K3sClusterResource>, string?, string?, string?)extensionats export
IResourceBuilder<K3sClusterResource>
WithK3sVersion(IResourceBuilder<K3sClusterResource>, string)extensionats export
IResourceBuilder<K3sClusterResource>
Sets the k3s image version used by the cluster server and all its agent nodes.
WithKubectlImage(IResourceBuilder<K3sClusterResource>, string?, string?, string?)extensionats export
IResourceBuilder<K3sClusterResource>
WithLifetime(IResourceBuilder<K3sClusterResource>, ContainerLifetime)extensionats export
IResourceBuilder<K3sClusterResource>
Sets the container lifetime for the k3s cluster and all its agent nodes.
WithPodSubnet(IResourceBuilder<K3sClusterResource>, string)extensionats export
IResourceBuilder<K3sClusterResource>
Sets the CIDR range for pod IP addresses ( --cluster-cidr).
WithServiceSubnet(IResourceBuilder<K3sClusterResource>, string)extensionats export
IResourceBuilder<K3sClusterResource>
Sets the CIDR range for Service cluster IPs ( --service-cidr).
View all methods