Skip to content
DocsTry Aspire
DocsTry

K3sClusterResource Methods

ClassMethods1 member
Represents a k3s Kubernetes cluster running as a privileged container resource. Injects the cluster's kubeconfig into a dependent resource.
  • Host processes receive KUBECONFIG=<host-path>/local/kubeconfig.yaml.
  • Containers receive KUBECONFIG=/tmp/k3s-kubeconfig.yaml and a file-level bind-mount of the container-network kubeconfig variant. Both are applied by the BeforeStartEvent subscriber registered in AddK3sCluster.
GetConnectionStringAsync(CancellationToken)Section titled GetConnectionStringAsync(CancellationToken)ValueTask<string?>
Returns the host-accessible kubeconfig path for this cluster.
public sealed class K3sClusterResource
{
public ValueTask<string?> GetConnectionStringAsync(
CancellationToken cancellationToken = default(CancellationToken))
{
// ...
}
}
cancellationTokenCancellationTokenoptional