Kubernetes的默認調度和自定義調度詳解

默認調度和自定義調度詳解

默認調度

默認調度是 Kubernetes 中的內置機制,它使用調度器組件來管理分配容器的節點。調度器依據以下原則選擇合適的節點:

  1. 資源需求 :調度器會為每個 Pod 根據其 CPU 和內存需求選擇一個具有足夠資源的節點。
  2. 親和性和容忍性 :通過親和性規則和容忍性設置,可以將 Pod 調度到滿足特定標簽或其他 Pod 運行位置要求的節點上。
  3. 資源分配 :調度器會考慮節點上已運行的其他 Pod 和 Pod 的資源需求,以合理分配資源,不超出節點資源限制。
  4. Pod 爭用優先級 :優先級高的 Pod 更容易被調度到可用節點上。
  5. 本地性 :調度器更傾向于將新 Pod 調度到已經運行相關服務的節點上,以減少跨節點通信的開銷。

自定義調度

除了默認調度之外,Kubernetes 還允許用戶進行自定義調度,以滿足特定的業務需求。用戶可以通過以下方式實現自定義調度:

  1. 調度器擴展點 :Kubernetes 支持調度器插件的機制,用戶可以使用自定義的調度器插件替換默認調度器,并實現自己的調度算法。
  2. 親和性和容忍性調度規則 :通過在 Pod 的調度規范中指定親和性和容忍性規則,用戶可以要求 Pod 被調度到特定的節點上。
  3. 節點選擇器 :通過使用節點選擇器標簽,用戶可以將一組特定的節點應用于特定類型的工作負載。

調度原理

Kubernetes 的調度器基于優先級和可行性評分算法來決定將 Pod 調度到哪個節點。調度流程如下:

  1. 預選階段(Predicates) :調度器對每個節點應用預選謂詞函數,檢查是否滿足 Pod 的資源需求、親和性規則等。不滿足條件的節點將被標記為不可調度。
  2. 優選階段(Priorities) :調度器對所有可調度的節點應用優選函數,為每個節點分配優先級。優選函數根據爭用優先級和伸縮策略等標準為節點打分。
  3. 選定階段(Binding) :調度器選擇優先級最高的節點將 Pod 調度到該節點。如果存在多個具有相同最高優先級的節點,則將應用綁定函數來決定最終調度。

On the other hand

Kubernetes is a powerful container orchestration platform that automates the deployment and management of containerized applications. An essential aspect of Kubernetes is its scheduling capability, which determines where to place containers within the cluster. In this blog, we will explore the default scheduling mechanism in Kubernetes and also understand how custom scheduling can be leveraged to meet specific business requirements.

Default Scheduling

Default scheduling is the built-in mechanism in Kubernetes that utilizes the scheduler component to manage container placement on nodes. The default scheduler follows these principles to select suitable nodes for pods:

  1. Resource Requirements : The scheduler matches each pod’s CPU and memory requirements with nodes having sufficient resources.
  2. Affinity and Tolerations : By using affinity rules and tolerations, pods can be scheduled on nodes with specific labels or meet certain requirements defined by other pods.
  3. Resource Allocation : The scheduler takes into account the already running pods and their resource demands on each node, ensuring fair distribution without exceeding node resource limits.
  4. Pod Preemption Priority : Pods with higher priority have a better chance of being scheduled on available nodes.
  5. Locality : The scheduler prefers to place new pods on nodes already running related services to minimize inter-node communication overhead.

Custom Scheduling

While default scheduling covers most scenarios, Kubernetes allows users to implement custom scheduling to cater to specific business needs. Custom scheduling can be achieved through the following approaches:

  1. Scheduler Plugins : Kubernetes supports scheduler plugin mechanisms that enable users to replace the default scheduler with their own implementation, incorporating custom scheduling algorithms.
  2. Affinity and Tolerations Scheduling Rules : By specifying affinity and tolerations rules in pod scheduling specifications, users can enforce pods to be scheduled on specific nodes.
  3. Node Selectors : By using node selector labels, users can apply a specific set of nodes for specific types of workloads.

Scheduling Principles

The Kubernetes scheduler utilizes priority and feasibility scoring algorithms to determine which node a pod should be scheduled on. The scheduling process includes the following stages:

  1. Predicates Stage : The scheduler applies predicate functions to each node to evaluate if pods meet resource requirements, affinity rules, and other conditions. Nodes that fail the predicates are marked as not scheduling candidates.
  2. Priorities Stage : The scheduler assigns priority scores to all nodes based on various criteria such as contention, autoscaling policies, etc.
  3. Binding Stage : The scheduler selects the node with the highest priority score to bind the pod. In case of multiple nodes with the same highest priority, binding functions come into play for the final decision.

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/35604.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/35604.shtml
英文地址,請注明出處:http://en.pswp.cn/news/35604.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

Android使用kotlin+協程+room數據庫的簡單應用

前言:一般主線程(UI線程)中是不能執行創建數據這些操作的,因為等待時間長。所以協程就是為了解決這個問題出現。 第一步:在模塊級的build.gradle中引入 id com.android.application// roomid kotlin-androidid kotlin…

Mysql主從分離

一、前言 某個應用場景中,在操作數據庫這部分,往往是數據庫的讀取往往大于數據庫的寫入,當讀取數據達到數據庫的瓶頸時,性能下滑,影響數據的寫入,導致整個應用的不可用。為了解決這個問題,這時&…

單片機直驅兩相四線步進電機研究

【本文發布于https://blog.csdn.net/Stack_/article/details/132236329,未經允許不得轉載,轉載須注明出處】 雙極性步進電機(兩相四線步進電機),原理的東西就先不講太多了,還沒搞清楚,邊查資料邊…

jsoup解析html之table表格

jsoup解析html之table表格 jsoup說明 一款Java 的HTML解析器 jsoup 是一款Java 的HTML解析器,可直接解析某個URL地址、HTML文本內容。它提供了一套非常省力的API,可通過DOM,CSS以及類似于jQuery的操作方法來取出和操作數據。 主要功能 從一…

Python Opencv實踐 - 圖像旋轉

import cv2 as cv import numpy as np import matplotlib.pyplot as pltimg cv.imread("../SampleImages/pomeranian.png", cv.IMREAD_COLOR)#圖像旋轉 #Opencv中的旋轉,首先通過cv.getRotationMatrix2D獲得旋轉矩陣 #cv.getRotationMatrix2D(center,ang…

Mr. Cappuccino的第62杯咖啡——Spring之Bean的生命周期

Spring之Bean的生命周期 Aware接口項目結構項目代碼運行結果源代碼使用場景 InitializingBean接口項目結構項目代碼運行結果源代碼 BeanFactoryPostProcessor接口項目結構項目代碼運行結果源代碼 Bean的生命周期項目結構項目代碼運行結果源代碼 Aware接口 實現Aware接口是為了…

微信小程序實現圖片多點裁剪

話不多說&#xff0c;直接上代碼 1、頁面布局 <view class"buttons" style"height: 50px;"><view class"upload btn" style"background-color: #d18118;"bindtap"uploadImage"> 上傳圖片 </view><vie…

機器視覺項目流程和學習方法

機器視覺項目流程&#xff1a; 00001. 需求分析和方案建立 00002. 算法流程規劃和業務邏輯設計 00003. 模塊化編程和集成化實現 00004. 調試和優化&#xff0c;交付客戶及文檔 學習機器視覺的方法&#xff1a; 00001. 實戰學習&#xff0c;結合項目經驗教訓 00002. 學習…

c++參數傳遞

函數的參數傳遞 指的是形參與實參結合的過程&#xff0c;其基本方式包括值傳遞和引用傳遞兩種。 值傳遞 該方法把參數的實際值復制給函數的形式參數。在這種情況下&#xff0c;修改函數內的形式參數對實際參數沒有影響 #include<iostream> using namespace std;void swap…

NAS搭建指南二——影視資源中心

1. 刮削 這一部分是利用 tinyMediaManager 進行影視資源的評分、簡介以及圖片的搜集工作tinyMediaManager 官方網站地址下載及安裝過程&#xff1a;略我的主要修改的設置項如下所示&#xff1a; 使用方法&#xff1a; a. 點擊更新媒體庫 b. 選擇影片–>右鍵單擊–>…

時序預測 | MATLAB實現基于BiLSTM雙向長短期記憶神經網絡的時間序列預測-遞歸預測未來(多指標評價)

時序預測 | MATLAB實現基于BiLSTM雙向長短期記憶神經網絡的時間序列預測-遞歸預測未來(多指標評價) 目錄 時序預測 | MATLAB實現基于BiLSTM雙向長短期記憶神經網絡的時間序列預測-遞歸預測未來(多指標評價)預測結果基本介紹程序設計參考資料 預測結果 基本介紹 Matlab實現BiLST…

C++中的回調函數

1.普通函數作為回調函數 #include <iostream>void programA_FunA1() { printf("Iam ProgramA_FunA1 and be called..\n"); }void programA_FunA2() { printf("Iam ProgramA_FunA2 and be called..\n"); }void programB_FunB1(void (*callback)()) {…

年之年的選擇,組裝版

組件&#xff1a;<!--* Author: liuyu liuyuxizhengtech.com* Date: 2023-02-01 16:57:27* LastEditors: wangping wangpingxizhengtech.com* LastEditTime: 2023-06-30 17:25:14* Description: 時間選擇年 - 年 --> <template><div class"year-range-pick…

04.利用Redis國邏輯過期實現緩存功能---解決緩存擊穿

學習目標&#xff1a; 提示&#xff1a;學習如何利用Redis邏輯過期實現添加緩存功能解決緩存擊穿 學習產出&#xff1a; 緩存擊穿講解圖&#xff1a; 解決方案&#xff1a; 采用互斥鎖采用邏輯過期 1. 準備pom環境 <dependency><groupId>org.springframework…

⑤ Axios網絡請求

Axios安裝 cnpm install --save axios post請求需要用到的&#xff1a; cnpm install --save querystring(用來轉換格式的) 引入 一般是全局引入&#xff0c;在main.js中引入 全局引入后的get和post方式使用 get請求方式 post請求方式 先引入&#xff1a; axios封裝…

STM32 定時器自動重裝載寄存器ARR帶來的影響,ARPE0和1區別

ARR是啥 自動重載寄存器是預裝載的。對自動重載寄存器執行寫入或讀取操作時會訪問預裝載寄存器。預裝載寄存器的內容既可以直接傳送到影子寄存器&#xff0c;也可以在每次發生更新事件 (UEV) 時傳送到影子寄存器&#xff0c;這取決于 TIMx_CR1 寄存器中的自動重載預裝載使能位 …

Go和Java實現中介者模式

Go和Java實現中介者模式 下面通過一個同事之間相互通信的例子來說明中介者模式的使用。 1、中介者模式 中介者模式是用來降低多個對象和類之間的通信復雜性。這種模式提供了一個中介類&#xff0c;該類通常處理不同類之間的 通信&#xff0c;并支持松耦合&#xff0c;使代碼…

1.作用域

1.1局部作用域 局部作用域分為函數作用域和塊作用域。 1.函數作用域: 在函數內部聲明的變量只能在函數內部被訪問&#xff0c;外部無法直接訪問。 總結&#xff1a; (1)函數內部聲明的變量&#xff0c;在函數外部無法被訪問 (2)函數的參數也是函數內部的局部變量 (3)不同函數…

Redis——三個特殊的數據類型+事務

概述 全稱為遠程字典服務。 Redis——基礎篇(包含redis在云服務上的docker化安裝和連接以及常用命令)_連接docker中的redis_北嶺山腳鼠鼠的博客-CSDN博客 Redis能干什么&#xff1f; 1.內存存儲、持久化&#xff0c;內存中是斷電即失&#xff0c;因此持久化很重要&#xff…

【LVS-NAT配置】

配置 node1&#xff1a;128&#xff08;客戶端&#xff09; node2&#xff1a;135&#xff08;調度器&#xff09; RS&#xff1a; node3&#xff1a;130 node4&#xff1a;132 node2添加網絡適配器&#xff08;僅主機模式&#xff09; [rootnode2 ~]# nmtui[rootnode2 ~]#…