# WeightedPodAffinityTermV1 Properties

- Package: [Aspire.Hosting.Kubernetes](/reference/api/csharp/aspire.hosting.kubernetes.md)
- Type: [WeightedPodAffinityTermV1](/reference/api/csharp/aspire.hosting.kubernetes/weightedpodaffinitytermv1.md)
- Kind: `Properties`
- Members: `2`

Represents a weighted pod affinity term used in Kubernetes scheduling policies. WeightedPodAffinityTermV1 defines a preference for scheduling pods closer to other pods based on affinity/anti-affinity rules.

## PodAffinityTerm

- Name: `PodAffinityTerm`
- Modifiers: `get; set`
- Returns: [PodAffinityTermV1](/reference/api/csharp/aspire.hosting.kubernetes/podaffinitytermv1.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Kubernetes/Resources/WeightedPodAffinityTermV1.cs)

Represents the pod affinity or anti-affinity requirement used in Kubernetes scheduling. This property is used to define rules that influence pod placement based on the labels, namespaces, and topology keys of other pods in a cluster.

```csharp
public PodAffinityTermV1 PodAffinityTerm { get; set; }
```

## Remarks

The PodAffinityTerm allows specifying conditions for controlling pod scheduling by defining criteria such as: - Label selectors to match specific labels of target pods. - Namespace selectors to limit the matching pods to specific namespaces. - A topology key to define the domain that is considered for affinity or anti-affinity rules.

## Weight

- Name: `Weight`
- Modifiers: `get; set`
- Returns: `int`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Kubernetes/Resources/WeightedPodAffinityTermV1.cs)

Gets or sets the weight associated with the pod affinity term. The weight indicates the importance of the term relative to other terms. A higher weight implies a stronger preference or priority for satisfying the associated pod affinity term.

```csharp
public int Weight { get; set; }
```
