All Documents
Current Document

Content is empty

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

Documentation

Node affinity

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

Node affinity

Similar to the node selector policy, the node affinity policy allows you to specify the nodes onto which pods can be scheduled based on node labels.

  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 NodeAffinity.
  7. In the Add NodeAffinity panel, set a node affinity policy based on node labels to meet your business needs and click OK. image.png

The following table describes the detailed settings of a node affinity policy.

Required and preferred rules

Parameter Description
Required The rules that the target node must meet. 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 The rules that the target node is expected to meet. This parameter corresponds to the preferredDuringSchedulingIgnoredDuringExecution parameter in Kubernetes. Pods are preferentially scheduled onto a node that meets preferred rules. You can set weights in preferred rules. If multiple nodes meet the specified rules during scheduling, pods are preferentially scheduled onto the node with the highest weight. 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.

Operators

Parameter Description
In Indicates that the label value is included in the value list.
NotIn Indicates that the label value is not in the specified list.
Gt Indicates that the label value is greater than the specified value.
Lt Indicates that the label value is less than the specified value.
Exists Indicates that the specified label exists.
DoesNotExist Indicates that the specified label does not exist.
On this page
Pure ModeNormal Mode

Pure Mode

Click to preview the document content in full screen
Feedback