当前位置:网站首页>【Kubernetes】Kubernetes 原理剖析与实战应用(更新中)
【Kubernetes】Kubernetes 原理剖析与实战应用(更新中)
2022-06-26 18:20:00 【curd_boy】
Kubernete 怎样控制业务的资源水位?

VPA

资源优化:Kubernete 中GC(垃圾回收)


K8S的调度优先级与抢占机制
官方文档 https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/
正常情况下
当一个Pod调度失败后,它就会被暂时“搁置”起来,直到Pod被更新,或者集群状态发生变化,调度器才会对这个Pod进行重新调度
优先级和抢占机制,解决的是Pod调度失败时该怎么办的问题
在调度过程中,会有各种预选和优选算法,在经过了那么多道门槛之后,一个POD才能完成调度,提供服务,在调度过程中,假设有一个很重要的系统服务调度失败了,导致了故障,为了避免这种情况,我们可以对该应用设置一个相对较高的优先级,在调度失败后,将一些优先级相对较低的不是那么重要的应用”挤走“,这就是K8S调度的优先级和抢占的作用。
特殊要求的场景:
当一个高优先级的Pod调度失败后,该Pod并不会被“搁置”,而是会“挤走”某个Node上的一些低优先级的Pod.这样就保证这个高优先级Pod的调度成功
PriorityClass参数限制
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: high-priority-nonpreempting
value: 1000000
preemptionPolicy: Never
globalDefault: false
description: "This priority class will not cause other pods to be preempted."
Kubernetes规定优先级是一个32bit的整数,最大值不超过1000000000(10 亿,1 billion),并且值越大代表优先级越高.而超出10亿的值,其实是被Kubernetes保留下来分配给系统 Pod 使用的.这样做的目的,就是保证系统Pod不会被用户抢占掉。

tips:
K8S在发生调度失败后,会基于优先级进行抢占,抢占并不是简单的将Node上的低优先级的pod”挤走“,抢占的设计还是相对比较有意思的。
https://blog.51cto.com/u_2010293/2781899
Kubernete中定时任务
https://kubernetes.io/zh-cn/docs/concepts/workloads/controllers/cron-jobs/
CronJob Spec
.spec.schedule:调度,必需字段,指定任务运行周期,格式同 Cron
.spec.jobTemplate:Job 模板,必需字段,指定需要运行的任务,格式同 Job
.spec.startingDeadlineSeconds :启动 Job 的期限(秒级别),该字段是可选的。如果因为任何原因而错过了被调度的时间,那么错过执行时间的 Job 将被认为是失败的。如果没有指定,则没有期限
.spec.concurrencyPolicy:并发策略,该字段也是可选的。它指定了如何处理被 Cron Job 创建的 Job 的并发执行。只允许指定下面策略中的一种:
- Allow(默认):允许并发运行 Job
- Forbid:禁止并发运行,如果前一个还没有完成,则直接跳过下一个
- Replace:取消当前正在运行的 Job,用一个新的来替换
注意,当前策略只能应用于同一个 Cron Job 创建的 Job。如果存在多个 Cron Job,它们创建的 Job 之间总是允许并发运行。
.spec.suspend :挂起,该字段也是可选的。如果设置为 true,后续所有执行都会被挂起。它对已经开始执行的 Job 不起作用。默认值为 false。
.spec.successfulJobsHistoryLimit 和 .spec.failedJobsHistoryLimit :历史限制,是可选的字段。它们指定了可以保留多少完成和失败的 Job。
默认情况下,它们分别设置为 3 和 1。设置限制的值为 0,相关类型的 Job 完成后将不会被保留。
边栏推荐
- [unity] use C in unity to execute external files, such as Exe or bat
- ISO文件
- sql中的几种删除操作
- Get and set settings in 26class
- 深度学习之Numpy篇
- (multi threading knowledge points that must be mastered) understand threads, create threads, common methods and properties of using threads, and the meaning of thread state and state transition
- DoS及攻擊方法詳解
- Detailed explanation of asymmetric cryptosystem
- Crawl Douban to read top250 and import it into SqList database (or excel table)
- 手机影像内卷几时休?
猜你喜欢

Deep understanding of MySQL lock and transaction isolation level

wechat_ Solve the problem of page Jump and parameter transfer by navigator in wechat applet

Let torch cuda. is_ Experience of available() changing from false to true

DVD-数字通用光盘

LeetCode 面试题29 顺时针打印矩阵

Leetcode 238 product of arrays other than itself

tag动态规划-刷题预备知识-2. 0-1背包理论基础和二维数组解法模板

In and exceptions, count (*) query optimization

Binary search-1

Chinese (Simplified) language pack
随机推荐
Image binarization
sql中的几种删除操作
DoS及攻擊方法詳解
Which securities company is better for a novice to open a stock trading account? How is it safer to speculate in stocks??
Concept and working principle of data encryption standard (DES)
JVM入个门(1)
LeetCode 128最长连续序列
Leetcode 128 longest continuous sequence
Detailed explanation of dos and attack methods
Determine whether a sequence is a stack pop-up sequence
How about opening a flush account? Is it safe? How to open a stock trading account
Ethereum技术架构介绍
Chinese (Simplified) language pack
Leetcode 238 product of arrays other than itself
深入理解MySQL锁与事务隔离级别
Tag dynamic programming - preliminary knowledge for question brushing -2 0-1 knapsack theory foundation and two-dimensional array solution template
in和exsits、count(*)查询优化
ROS query topic specific content common instructions
JS common regular expressions
行锁分析和死锁