All Documents
Current Document

Content is empty

If you don't find the content you expect, please try another search term

Documentation

Pod anti-affinity

Last updated:2021-09-29 22:05:17

Pod anti-affinity

A pod anti-affinity policy allows you to prevent the pods where your workloads are run from being deployed in the same topology domain as specified pods, and prevent pods that are already running on nodes from being scheduled onto specified nodes based on the labels of the pods.

  1. Log in to the Kingsoft Cloud Container Engine (KCE) console.
  2. In the left navigation pane, click Cluster.
  3. Click the ID of the target cluster. The cluster details page appears.
  4. In the left navigation pane, choose Workload > Deployment. The deployment list page appears.

    Note

    • You can go to the Deployment, StatefulSet, or DaemonSet page as required.
  5. Click Create in the upper-left corner. On the Create Deployment page, set the parameters and click Next to go to step 2 Deployment Configuration.
  6. Click ShowAdvanced Settings at the bottom of the page and click Add PodAntiAffinity.
  7. In the Add PodAntiAffinity panel, set a pod anti-affinity policy based on pod labels to meet your business needs and click OK. image.png

The following table describes the detailed settings of a pod anti-affinity policy.

Required and preferred rules

Parameter Description
Required Anti-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 node meets one or more required rules.
Preferred Anti-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

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.

Parameters

Parameter Description
Weight The weight condition in a preferred rule. Pods are preferentially scheduled onto a node with a higher weight.
Namespace The namespace where pods are scheduled based on the labels of the pods.
Topology Domain 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 anti-affinity settings.
Label Name The pod label of the corresponding workload. You can enter a label name or select one in the Select Application Label dialog box.
Operator The operator between the key and the value. Valid values: In, NotIn, Exists, and DoesNotExist.
Label Value 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.
On this page
Pure ModeNormal Mode

Pure Mode

Click to preview the document content in full screen
Feedback