Skip to content
Docs Try Aspire

PodAntiAffinityV1

Class sealed net10.0
📦 Aspire.Hosting.Kubernetes v13.1.2-preview.1.26125.13
Represents the pod anti-affinity rules used in Kubernetes scheduling policies.
namespace Aspire.Hosting.Kubernetes.Resources;
public sealed class PodAntiAffinityV1
{
// ...
}
PodAntiAffinityV1 defines constraints for scheduling pods on nodes based on anti-affinity rules. Anti-affinity is used to avoid placing certain pods close to each other or restrict them from being scheduled on the same nodes within the cluster. This can enhance fault tolerance, resource allocation, or other layout requirements.
View all constructors
PreferredDuringSchedulingIgnoredDuringExecutionget
A list of weighted pod affinity terms that are considered during scheduling. This property allows specifying optional pod anti-affinity preferences for scheduling decisions, while permitting the system to schedule pods in scenarios where the preferences cannot be met. Each term is associated with a weight that indicates its relative importance.
RequiredDuringSchedulingIgnoredDuringExecutionget
Represents a list of PodAffinityTermV1 objects used to define required pod anti-affinity constraints that must be met during pod scheduling but are ignored during execution. This property ensures that certain pod placement rules are enforced when scheduling occurs; however, these rules can be relaxed if the constraints are violated at runtime, such as when a node becomes unavailable or pods are rescheduled for fault recovery.
View all properties