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.mzph.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 ~]#…