当前位置:网站首页>Kubernetes的pod调度
Kubernetes的pod调度
2022-06-26 14:38:00 【华为云】
Kubernetes的pod调度
创建pod流程
用户通过kubectl进入apiserver中,把相关信息存储到etcd中,scheduler进入apiserver中看有没有pod的创建,如果有,通过etcd读取到对应的pod,然后通过调度算法,把pod调度到某个node节点中,结果信息更新到API Server中,API Server更新到etcd存储系统。pod被调度到的node节点通过kubelet访问apiserver,从而在etcd中读取到pod信息,然后通过docker创建容器
创建pod命令:
kubectl create deployment web --image=nginx
然后复制三次
kubectl scale deployment web --replicas=3
查看pod在节点上的分配情况
kubectl get pods -o wide
影响pod调度的属性
pod的yaml文件中对资源的限制影响pod的调度,节点选择器nodeSelector标签也会影响pod的调度
对于附带标签的资源对象,使用标签选择器挑选出符合条件的资源完成所需操作。创建资源的时候,可以直接在其metadata中的labels属性设置标签,标签以key-value形式设置,也可以使用下面的命令
对节点创建标签的命令:
kubectl label node node1 env_role=dev
scheduler守护进程负责在各工作节点中基于系统资源的可用性挑选一个来运行待创建的pod对象,Kubernetes将所有工作节点抽象成资源池的资源统一分配使用。
用户先为node资源对象设定标签,然后配置pod对象通过节点标签选择器进行匹配检测,完成节点的调度
节点亲和性nodeAffinity也是和调度有关,节点亲和性分为硬亲和性和软亲和性,硬亲和性表示条件必须满足,软亲和性条件尽量满足。
污点
污点Taint是节点的属性
查看污点信息:
kubectl describe node node1 | grep Taint
值为NoSchedule表示不会被调用,PreferNoSchedule表示尽量不调度,NoExecute表示不会被调度的同时会把当前节点的pod删掉
添加污点信息:
kubectl taint node node1 env_role=yes:NoSchedule
删除污点信息:
kubectl taint node node1 env_role:NoSchedule-
有污点容忍属性,表示某个节点即使设置了污点也有可能被调度到
️ 感谢大家
如果你觉得这篇内容对你挺有有帮助的话:
- 欢迎关注我️,点赞,评论,转发
- 关注
盼盼小课堂
,定期为你推送好文,还有群聊不定期抽奖活动,可以畅所欲言,与大神们一起交流,一起学习。
边栏推荐
- R语言dplyr包intersect函数获取在两个dataframe中都存在的数据行、获取两个dataframe交叉的数据行
- Naacl2022: (code practice) good visual guidance promotes better feature extraction, multimodal named entity recognition (with source code download)
- 赠书 | 《认知控制》:我们的大脑如何完成任务?
- 关于 selenium.common.exceptions.WebDriverException: Message: An unknown server-side error 解决方案(已解决)
- Error when redis is started: could not create server TCP listening socket *: 6379: bind: address already in use - solution
- 使用 Abp.Zero 搭建第三方登录模块(二):服务端开发
- PostGIS create spatial database
- R语言glm函数逻辑回归模型、使用epiDisplay包logistic.display函数获取模型汇总统计信息(自变量初始和调整后的优势比及置信区间,回归系数的Wald检验的p值)、结果保存到csv
- Common evaluation indexes of classification model -- confusion matrix and ROC curve
- Sharing ideas for a quick switch to an underlying implementation
猜你喜欢
随机推荐
【使用yarn运行报错】The engine “node“ is incompatible with this module.
C语言刷题随记 —— 乒乓球比赛
Is it safe to open a stock account through the account opening link given by the broker manager? I want to open an account
Use abp Zero builds a third-party login module (II): server development
The engine "node" is inconsistent with this module
关于 selenium.common.exceptions.WebDriverException: Message: An unknown server-side error 解决方案(已解决)
MHA高可用配合及故障切换
一个快速切换一个底层实现的思路分享
Electron
券商经理给的开户链接安全吗?找谁可以开户啊?
Mathematical modeling of war preparation 30 regression analysis 2
ArcGIS secondary development - arcpy delete layer
Excel-vba quick start (II. Condition judgment and circulation)
R语言caTools包进行数据划分、scale函数进行数据缩放、class包的knn函数构建K近邻分类器
C语言基础知识入门(大全)「建议收藏」
15 BS object Node name Node name String get nested node content
Authoritative announcement on the recruitment of teachers in Yan'an University in 2022
TS常用数据类型总结
扩展-Hooks
《三体》摘录