tencent cloud

Feedback

Setting the Scheduling Rule for a Workload

Last updated: 2023-05-25 11:22:18

    Overview

    You can specify the scheduling of the Pods under a workload in the cluster by setting the scheduling policy in the advanced settings of the workload. The following are the typical use cases:

    • Run the Pods on a specific node.
    • Run the Pods on nodes in a specific scope (which can be an availability zone, a model and so on).

    How to Configure Scheduling policies

    Prerequisites

    • Kubernetes 1.7 or later, and scheduling policies are configured. Scheduling policies can be found under the Advanced Settings of a workload.
    • To ensure that your Pods can be scheduled successfully, the node should have resources available for container scheduling after the scheduling policy is configured.
    • You need node labels if you use custom scheduling features. For details, refer to Setting Node Label.

    Configuring a scheduling policy

    If your cluster is created using Kubernetes 1.7 or later, you can set a scheduling policy when creating a workload.
    Select one of the following scheduling types:

    • Schedule to a specific node: schedule Pods to a specific node with matching node labels.
    • Custom scheduling: customize how Pods are scheduled by matching Pod labels.

    Custom scheduling policies have the following modes:

    • Conditions that must be met: if a node meets the affinity conditions, the Pods are scheduled to the corresponding node. If not, the scheduling fails.
    • Conditions that should be met if possible: if a node meets the affinity conditions, the Pods are scheduled to the corresponding node. If not, the pods are scheduled to a random node.

    Multiple custom scheduling policies can be added. The following is a list of operators:

    • In: the value of the label is in the list.
    • NotIn: the value of the label is not in the list.
    • Exists: the key of the label exists.
    • DoesNotExits: the key of the label does not exist.
    • Gt: the value of the label is greater than the listed value (string match).
    • Lt: the value of the label is less than the listed value (string match).

    How It Works

    Kubernetes uses YAML files to distribute scheduling policies and the affinity and anti-affinity mechanism ensures that Pods are scheduled according to rules. For more information on this mechanism, refer to Kubernetes official documentation.

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support