Last updated：2021-09-29 22:05:17
A pod affinity policy allows you to deploy the pods where your workloads are run in the same topology domain as specified pods, and schedule pods that are already running on nodes onto specified nodes based on the labels of the pods.
- You can go to the Deployment, StatefulSet, or DaemonSet page as required.
The following table describes the detailed settings of a pod affinity policy.
|Affinity rules that must be met for pod scheduling. This parameter corresponds to the requiredDuringSchedulingIgnoredDuringExecution parameter in Kubernetes. You can click Add Scheduling Rule in the Required section to add multiple required rules. Pods can be scheduled onto a node if the pod meets one or more required rules.
|Affinity rules that are expected to be met for pod scheduling. This parameter corresponds to the preferredDuringSchedulingIgnoredDuringExecution parameter in Kubernetes. You can click Add Scheduling Rule in the Preferred section to add multiple preferred rules. Pods can be scheduled onto a node regardless of whether a preferred rule is met.
Selectors correspond to the matchExpressions parameter in Kubernetes. You can click Add Selector to add multiple selectors. Pods can be scheduled onto a node only when the conditions of all selectors are met.
|The weight condition in a preferred rule. Pods are preferentially scheduled onto a node with a higher weight.
|The namespace where pods are scheduled based on the labels of the pods.
|The key of the domain where pods are scheduled. Topology domains are specified by setting node labels, such as kubernetes.io/hostname.
|View Application List
|Allows you to view applications in namespaces as required and import available labels into the affinity settings.
|The pod label of the corresponding workload. You can enter a label name or select one in the Select Application Label dialog box.
|The operator between the key and the value. Valid values: In, NotIn, Exists, and DoesNotExist.
|The value of the label. If the Operator parameter is set to In or NotIn, you can set one or more values. If the Operator parameter is set to Exists or DoesNotExist, which is used to determine whether the label exists, you do not need to specify the label value.