# K3sAgentResource Constructors

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

Represents a k3s agent (worker) node belonging to a [K3sClusterResource](/reference/api/csharp/communitytoolkit.aspire.hosting.k3s/k3sclusterresource.md).

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

## K3sAgentResource(string, K3sClusterResource)

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

Represents a k3s agent (worker) node belonging to a [K3sClusterResource](/reference/api/csharp/communitytoolkit.aspire.hosting.k3s/k3sclusterresource.md).

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

## Parameters

- `name` (`string`)
  The resource name, e.g. `k8s-agent-0`.
- `cluster` ([K3sClusterResource](/reference/api/csharp/communitytoolkit.aspire.hosting.k3s/k3sclusterresource.md))
  The parent k3s cluster resource.

## Remarks

Agent nodes run `k3s agent` and join the server at `https://{serverName}:6443` using DCP's Docker DNS. They start in parallel with the server without a `WaitFor` dependency -- k3s's built-in retry loop handles the connection timing. The cluster's health check waits for all `1 + AgentCount` nodes to reach `Ready` state before the cluster resource transitions to `Running`. Agent nodes are created automatically by `AddK3sCluster` when `K3sClusterOptions.AgentCount` is greater than zero.
