Detailed explanation of the concept of Pod resource scheduling strategy (12)_Resource Scheduling

Preface

In the era of cloud computing, it is crucial to effectively schedule Pod resources in a Kubernetes cluster. In this article, we will delve into the concept of Pod resource scheduling strategies in Kubernetes clusters and how to choose the best scheduling strategy based on your needs.

First, we need to understand Pod resource scheduling in the Kubernetes cluster. In Kubernetes, a Pod is the smallest, deployable unit that contains all the resources needed to run an application. The resource scheduler is one of the core components of Kubernetes and is responsible for allocating and scheduling Pods on nodes.

Pod resource scheduling policies are the rules and guidelines used by the resource scheduler when deciding on which node to place a Pod. Proper scheduling strategies are critical to achieving application performance, scalability, and disaster recovery.

Overview

By default, which node a pod is on is calculated by the scheduler component using a response algorithm. This process is not subject to manual control, but in actual use, this does not meet the needs. In many cases, we If you want to control certain pods to run on certain nodes, you need to use the pod scheduling strategy.

Scheduling strategy

  • Automatic scheduling: Which node to run on is completely calculated by the scheduler through a series of algorithms.
  • Directed scheduling: NodeName, NodeSelector
  • NodeName: Run on the specified node based on the node name.
  • NodeSelector: Based on the label on the node node, associate the label selector and ultimately decide which node to run on.
  • Affinity scheduling: NodeAffinity, PodAffinity, PodAntiAfinity.
  • Pods can choose which node to run on based on affinity, or they can choose not to run on which node based on anti-affinity.
  • Taint (tolerance) scheduling: Taints, Toleration
  • Node nodes can define taint policies and configure taint, which means that pods are not allowed to run on the current node.
  • Pods can define Toleration tolerance policies, that is, pods configured with tolerance can run on nodes configured with taint.