# K3sClusterResource Constructors

- Package: [CommunityToolkit.Aspire.Hosting.K3s](/reference/api/csharp/communitytoolkit.aspire.hosting.k3s.md)
- Type: [K3sClusterResource](/reference/api/csharp/communitytoolkit.aspire.hosting.k3s/k3sclusterresource.md)
- Kind: `Constructors`
- Members: `1`

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`.

<a id="constructor"></a>
<a id="constructor-string"></a>

## K3sClusterResource(string)

- Name: `Constructor(string)`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d479e13473b1d29d06b974f144a0049289a3cb5c/src/CommunityToolkit.Aspire.Hosting.K3s/K3sClusterResource.cs#L21-L96)

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`.

```csharp
public sealed class K3sClusterResource
{
    public K3sClusterResource(
        string name)
    {
        // ...
    }
}
```

## Parameters

- `name` (`string`)
  The resource name.
