Get the App
SLTechnology News&Howtos  ›  Servers  › 

38 of kubernetes practice: Pod scheduling

Shulou Source: shulou.com Published: 2022-06-02 06:08:06 11月12日 Update

One: Deployment/RC: fully automatic scheduling

One of the main functions of Deployment or RC is to automatically deploy multiple copies of a container application and continuously monitor the number of copies to maintain the number of copies specified by users in the cluster.

Second: NodeSelector: directed scheduling

Pod can be dispatched to a specified node by matching the tag (Label) of Node with the nodeSelector attribute of Pod.

Three: NodeAffinity: affinity scheduling

At present, there are two kinds of node affinity expressions for the new scheduling strategy to replace NodeSelector.

1. RequiredDuringSchedulingIgnoredDuringExecution: the specified rules must be met before Pod can be dispatched to Node, which is equivalent to a hard limit.

2. PreferredDuringSchedulingIgnoredDuringExecution: emphasize that the specified rules are met first, and the scheduler will try to schedule Pod to Node, but it is not required, which is equivalent to a soft limit. Multiple priority rules can also set weight values to define the order of execution.

If both nodeSelector and nodeAffinity are defined, both conditions must be met for Pod to eventually run on the specified Node.

Four: PodAffinity: affinity and mutually exclusive scheduling strategy

V: Taints and Tolerations (stain and tolerance)

Taint needs to be used in conjunction with Toleration to keep Pod away from unsuitable Node. After setting up one or more Taint on Node, Pod cannot run on those Node unless it is clear that life can tolerate these "stains." Toleration is an attribute of Pod that allows Pod to run on Node marked with Taint.

Six: DaemonSet: schedule a Pod on each Node

Seven: Job batch scheduling

1.Job Template Expansion mode: a Job object corresponds to a Work item to be processed, and several Work item can generate several independent Job, which is usually suitable for scenarios where the number of Work item is small and the amount of data processed by each Work item is relatively large.

2.Queue with Pod Per Work Item mode: a task queue is used to store Work item, and a Job object is used as a consumer to complete these Work item. In this mode, Job launches N Pod, each Pod corresponds to a Work item.

3.Queue with Variable Pod Count mode: a task queue is also used to store Work item, and a Job object is used as a consumer to complete these Work item, but unlike the above mode, the number of Pod started by Job is variable.

Eight: Cronjob: scheduled tasks

Similar to the scheduled task Cron Job of Linux Cron.

Nine: custom scheduling

Tags: Scheduling pattern task quantity affinity replica object rule run affinity multiple attribute stain consumer policy node queue processing consumption restriction Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Shulou Technology NVidia macOS OPPO Reno