当前位置: 首页 > news >正文

加强企业网站建设门户网站应该怎么做

加强企业网站建设,门户网站应该怎么做,论坛网站免费建设模板,做添加剂的外贸网站有哪些查看案例 字段含义podAffinityPod 间的亲和性定义podAntiAffinityPod 间的反亲和性定义requiredDuringSchedulingIgnoredDuringExecution硬性要求#xff0c;必须满足条件#xff0c;保证分散部署的效果最好使用用此方式preferredDuringSchedulingIgnoredDuringExecution软性…查看案例 字段含义podAffinityPod 间的亲和性定义podAntiAffinityPod 间的反亲和性定义requiredDuringSchedulingIgnoredDuringExecution硬性要求必须满足条件保证分散部署的效果最好使用用此方式preferredDuringSchedulingIgnoredDuringExecution软性要求可以不完全满足即有可能同一node上可以跑多个副本requiredDuringSchedulingIgnoredDuringExecutionlabelSelectortopologyKeypreferredDuringSchedulingIgnoredDuringExecutionweightpodAffinityTermlabelSelectortopologyKeytopologyKey可以理解为 Node 的 Label具有相同的 Label 的 Node视为同一拓扑如三个节点打上 Label - Node1 —— zonebeijing- Node2 —— zoneshanghai- Node3 —— zonebeijing那么 Node1 和 Node3 为同一拓扑Node2 为另一拓扑topologyKey: kubernetes.io/hostname上面为常见的配置可以通过 kubectl get nodes --show-labels看到节点上的 Lable就具有此 kubernetes.io/hostname Label因此就是将每个节点作为一个独立的拓扑 apiVersion: v1 kind: Pod metadata:name: test-pod spec:affinity:# 首先根据 labelSelector 选择具有 service.cpaas.io/name: deployment-nginx Label 的 所有 Pod# 接下来根据 podAffinity 亲和性将此 pod 调度到与选中 Pod 中具有 topologyKey 的 Node 上podAffinity:requiredDuringSchedulingIgnoredDuringExecution:- labelSelector:matchLabels:service.cpaas.io/name: deployment-nginxtopologyKey: kubernetes.io/hostname- labelSelector:matchLabels:service.cpaas.io/name: deployment-busyboxtopologyKey: kubernetes.io/hostname# 首先根据 labelSelector 选择具有 key 为 a value为 b 或 c 的 Label 的 Pod# 接下来根据 podAntiAffinity将此 pod 调度到与选中 Pod 中都不相同的 Node 上该节点需要具有 topologyKey labelpodAntiAffinity:preferredDuringSchedulingIgnoredDuringExecution:- weight: 100podAffinityTerm:labelSelector:matchExpressions:- key: aoperator: Invalues: [b, c]topologyKey: kubernetes.io/hostnamecontainers:- name: test-podimage: nginx:1.18 代码分析 代码路径pkg/scheduler/framework/plugins/interpodaffinity 首先根据调度器框架观察源码可以看出实现了一下四个接口 PreFilterFilterPreScoreScore 首先明确几点 该插件是考虑 Pod 间的亲和性和反亲和性就是新Pod 和 现存 Pod 的关系但最终结果是将 Pod 调度到合适的 Node 上因此要记录 Node 的信息 1 | PreFilter 此步骤作用 梳理出【现存哪些 Pod】 讨厌【新 Pod】记录【满足条件的现存 Pod】 对应 Node 信息为 existingPodAntiAffinityMap梳理出【新 Pod】喜欢【哪些现存Pod】记录【满足条件的现存 Pod】 对应 Node 信息为 incomingPodAffinityMap梳理出【新 Pod】讨厌【哪些现存Pod】记录【满足条件的现存 Pod】 对应 Node 信息为 incomingPodAntiAffinityMap 所以可以小总结一下 existingPodAntiAffinityMap 和 incomingPodAntiAffinityMap 这些记录的节点新 Pod 不喜欢incomingPodAffinityMap 记录的节点Pod 喜欢 问题 —— 为什么不梳理 【现存哪些 Pod】 喜欢【新 Pod】 因为现在是调度【新 Pod】只要不被讨厌不影响【现存 Pod 】就行因此只需要可能会影响的【现存 Pod】 注意上面所说的【条件】—— 指的是【硬性要求 requiredDuringSchedulingIgnoredDuringExecution 】 —— 因此才考虑这么详细 // 这里只截取了 PreFilter 部分重要函数 // pkg/scheduler/framework/plugins/interpodaffinity/filtering.go// 考虑现存 Pod 的 反亲和性 anti-affinity // 简单理解就是用现存 Pod 的 anti-affinity Terms 配置要求 NewPod记录下满足的 Node说明这些节点不能调度因为现存 Pod 排斥新 Pod // 这里的 anti-affinity Terms 是指 requiredDuringSchedulingIgnoredDuringExecution 定义的硬性要求 // 问题为什么不考虑现存 Pod 的亲和性 —— 因为现存 Pod 的亲和性是亲和他之前 Pod在其调度的时候早已考虑现在只需要考虑其反感的 // 代码级理解 // 1. 遍历所有具有 anti-affinity 现存 Pod // 2. 若即将调度的 NewPod 满足该 Pod 的 anti-affnity Terms // 3. 就记录到 existingPodAntiAffinityMap 中key 为该 Pod 所在的 node 信息topologyKey、topologyValuevalue 为满足的 Terms 次数 // 例如 map{hostnamenode011} // existingPodAntiAffinityMap will be used later for efficient check on existing pods anti-affinity existingPodAntiAffinityMap : getTPMapMatchingExistingAntiAffinity(pod, nodesWithRequiredAntiAffinityPods)// 考虑新 NewPod 的亲和性和反亲和性 // 简单理解 就是用 NewPod 的 anti-affinity 和 affinity Terms 配置要求现存的 Pod记录下满足的 Node // incomingPodAffinityMap will be used later for efficient check on incoming pods affinity // incomingPodAntiAffinityMap will be used later for efficient check on incoming pods anti-affinity incomingPodAffinityMap, incomingPodAntiAffinityMap : getTPMapMatchingIncomingAffinityAntiAffinity(podInfo, allNodes)2 | Filter *framework.CycleState 将上面统计的信息传递过来现在的工作就是 传来了一个 Node 信息判断该 Node 与上面的 existingPodAntiAffinityMap、incomingPodAntiAffinityMap 、incomingPodAffinityMap 的关系若该 Node 满足条件那么可以进入到下面的【打分阶段】 // pkg/scheduler/framework/plugins/interpodaffinity/filtering.go func (pl *InterPodAffinity) Filter(ctx context.Context, cycleState *framework.CycleState, pod *v1.Pod, nodeInfo *framework.NodeInfo) *framework.Status {if nodeInfo.Node() nil {return framework.NewStatus(framework.Error, node not found)}state, err : getPreFilterState(cycleState)if err ! nil {return framework.NewStatus(framework.Error, err.Error())}if !satisfyPodAffinity(state, nodeInfo) {return framework.NewStatus(framework.UnschedulableAndUnresolvable, ErrReasonAffinityNotMatch, ErrReasonAffinityRulesNotMatch)}if !satisfyPodAntiAffinity(state, nodeInfo) {return framework.NewStatus(framework.Unschedulable, ErrReasonAffinityNotMatch, ErrReasonAntiAffinityRulesNotMatch)}if !satisfyExistingPodsAntiAffinity(state, nodeInfo) {return framework.NewStatus(framework.Unschedulable, ErrReasonAffinityNotMatch, ErrReasonExistingAntiAffinityRulesNotMatch)}return nil }3 | PreScore 这部分主要看 processExistingPod 函数 可以看出根据【现存 Pod】 和【新 Pod】的【软性要求preferredDuringSchedulingIgnoredDuringExecution】对节点进行打分 // pkg/scheduler/framework/plugins/interpodaffinity/scoring.go // PreScore builds and writes cycle state used by Score and NormalizeScore. func (pl *InterPodAffinity) PreScore(pCtx context.Context,cycleState *framework.CycleState,pod *v1.Pod,nodes []*v1.Node, ) *framework.Status {// ... ...topoScores : make([]scoreMap, len(allNodes))index : int32(-1)processNode : func(i int) {nodeInfo : allNodes[i]if nodeInfo.Node() nil {return}// Unless the pod being scheduled has affinity terms, we only// need to process pods with affinity in the node.podsToProcess : nodeInfo.PodsWithAffinityif hasAffinityConstraints || hasAntiAffinityConstraints {// We need to process all the pods.podsToProcess nodeInfo.Pods}topoScore : make(scoreMap)for _, existingPod : range podsToProcess {pl.processExistingPod(state, existingPod, nodeInfo, pod, topoScore)}if len(topoScore) 0 {topoScores[atomic.AddInt32(index, 1)] topoScore}}parallelize.Until(context.Background(), len(allNodes), processNode)for i : 0; i int(index); i {state.topologyScore.append(topoScores[i])}cycleState.Write(preScoreStateKey, state)return nil }func (pl *InterPodAffinity) processExistingPod(state *preScoreState,existingPod *framework.PodInfo,existingPodNodeInfo *framework.NodeInfo,incomingPod *v1.Pod,topoScore scoreMap, ) {existingPodNode : existingPodNodeInfo.Node()// For every soft pod affinity term of pod, if existingPod matches the term,// increment p.counts for every node in the cluster with the same term.TopologyKey// value as that of existingPodss node by the terms weight.topoScore.processTerms(state.podInfo.PreferredAffinityTerms, existingPod.Pod, existingPodNode, 1)// For every soft pod anti-affinity term of pod, if existingPod matches the term,// decrement p.counts for every node in the cluster with the same term.TopologyKey// value as that of existingPods node by the terms weight.topoScore.processTerms(state.podInfo.PreferredAntiAffinityTerms, existingPod.Pod, existingPodNode, -1)// For every hard pod affinity term of existingPod, if pod matches the term,// increment p.counts for every node in the cluster with the same term.TopologyKey// value as that of existingPods node by the constant args.hardPodAffinityWeightif pl.args.HardPodAffinityWeight 0 {for _, term : range existingPod.RequiredAffinityTerms {t : framework.WeightedAffinityTerm{AffinityTerm: term, Weight: pl.args.HardPodAffinityWeight}topoScore.processTerm(t, incomingPod, existingPodNode, 1)}}// For every soft pod affinity term of existingPod, if pod matches the term,// increment p.counts for every node in the cluster with the same term.TopologyKey// value as that of existingPods node by the terms weight.topoScore.processTerms(existingPod.PreferredAffinityTerms, incomingPod, existingPodNode, 1)// For every soft pod anti-affinity term of existingPod, if pod matches the term,// decrement pm.counts for every node in the cluster with the same term.TopologyKey// value as that of existingPods node by the terms weight.topoScore.processTerms(existingPod.PreferredAntiAffinityTerms, incomingPod, existingPodNode, -1) }4 | Score 这部分就是将节点的得分进行累计计算返回此符合条件的节点的得分数 注意所有符合条件都会调用此函数得到自己对应的分数 // pkg/scheduler/framework/plugins/interpodaffinity/scoring.go // Score invoked at the Score extension point. // The score returned in this function is the sum of weights got from cycleState which have its topologyKey matching with the nodes labels. // it is normalized later. // Note: the returned score is positive for pod-affinity, and negative for pod-antiaffinity. func (pl *InterPodAffinity) Score(ctx context.Context, cycleState *framework.CycleState, pod *v1.Pod, nodeName string) (int64, *framework.Status) {nodeInfo, err : pl.sharedLister.NodeInfos().Get(nodeName)if err ! nil || nodeInfo.Node() nil {return 0, framework.NewStatus(framework.Error, fmt.Sprintf(getting node %q from Snapshot: %v, node is nil: %v, nodeName, err, nodeInfo.Node() nil))}node : nodeInfo.Node()s, err : getPreScoreState(cycleState)if err ! nil {return 0, framework.NewStatus(framework.Error, err.Error())}var score int64for tpKey, tpValues : range s.topologyScore {if v, exist : node.Labels[tpKey]; exist {score tpValues[v]}}return score, nil }
文章转载自:
http://www.morning.qnxkm.cn.gov.cn.qnxkm.cn
http://www.morning.qxwwg.cn.gov.cn.qxwwg.cn
http://www.morning.kzcfp.cn.gov.cn.kzcfp.cn
http://www.morning.jfbgn.cn.gov.cn.jfbgn.cn
http://www.morning.cjwkf.cn.gov.cn.cjwkf.cn
http://www.morning.ydwnc.cn.gov.cn.ydwnc.cn
http://www.morning.ktbjk.cn.gov.cn.ktbjk.cn
http://www.morning.rxhs.cn.gov.cn.rxhs.cn
http://www.morning.sjsks.cn.gov.cn.sjsks.cn
http://www.morning.kpbn.cn.gov.cn.kpbn.cn
http://www.morning.hbjqn.cn.gov.cn.hbjqn.cn
http://www.morning.jnzfs.cn.gov.cn.jnzfs.cn
http://www.morning.inheatherskitchen.com.gov.cn.inheatherskitchen.com
http://www.morning.fjglf.cn.gov.cn.fjglf.cn
http://www.morning.gbnsq.cn.gov.cn.gbnsq.cn
http://www.morning.brscd.cn.gov.cn.brscd.cn
http://www.morning.lgkbn.cn.gov.cn.lgkbn.cn
http://www.morning.qzpw.cn.gov.cn.qzpw.cn
http://www.morning.gqflj.cn.gov.cn.gqflj.cn
http://www.morning.xuejitest.com.gov.cn.xuejitest.com
http://www.morning.gfjgq.cn.gov.cn.gfjgq.cn
http://www.morning.pkmw.cn.gov.cn.pkmw.cn
http://www.morning.tkzqw.cn.gov.cn.tkzqw.cn
http://www.morning.fnhxp.cn.gov.cn.fnhxp.cn
http://www.morning.pqjpw.cn.gov.cn.pqjpw.cn
http://www.morning.pqqxc.cn.gov.cn.pqqxc.cn
http://www.morning.hxxwq.cn.gov.cn.hxxwq.cn
http://www.morning.mrlkr.cn.gov.cn.mrlkr.cn
http://www.morning.mtrrf.cn.gov.cn.mtrrf.cn
http://www.morning.pqqzd.cn.gov.cn.pqqzd.cn
http://www.morning.gxqpm.cn.gov.cn.gxqpm.cn
http://www.morning.ubpsa.cn.gov.cn.ubpsa.cn
http://www.morning.rlbg.cn.gov.cn.rlbg.cn
http://www.morning.zphlb.cn.gov.cn.zphlb.cn
http://www.morning.nhlnh.cn.gov.cn.nhlnh.cn
http://www.morning.mnslh.cn.gov.cn.mnslh.cn
http://www.morning.qhtlq.cn.gov.cn.qhtlq.cn
http://www.morning.ntffl.cn.gov.cn.ntffl.cn
http://www.morning.yldgw.cn.gov.cn.yldgw.cn
http://www.morning.tkflb.cn.gov.cn.tkflb.cn
http://www.morning.lsgjf.cn.gov.cn.lsgjf.cn
http://www.morning.znkls.cn.gov.cn.znkls.cn
http://www.morning.tkzqw.cn.gov.cn.tkzqw.cn
http://www.morning.mjtgt.cn.gov.cn.mjtgt.cn
http://www.morning.jjsxh.cn.gov.cn.jjsxh.cn
http://www.morning.ccsdx.cn.gov.cn.ccsdx.cn
http://www.morning.prkdl.cn.gov.cn.prkdl.cn
http://www.morning.mxlwl.cn.gov.cn.mxlwl.cn
http://www.morning.youprogrammer.cn.gov.cn.youprogrammer.cn
http://www.morning.crfjj.cn.gov.cn.crfjj.cn
http://www.morning.rchsr.cn.gov.cn.rchsr.cn
http://www.morning.txkrc.cn.gov.cn.txkrc.cn
http://www.morning.wrdpj.cn.gov.cn.wrdpj.cn
http://www.morning.mrfnj.cn.gov.cn.mrfnj.cn
http://www.morning.pzjfz.cn.gov.cn.pzjfz.cn
http://www.morning.dsxgc.cn.gov.cn.dsxgc.cn
http://www.morning.srmpc.cn.gov.cn.srmpc.cn
http://www.morning.ljcf.cn.gov.cn.ljcf.cn
http://www.morning.kpygy.cn.gov.cn.kpygy.cn
http://www.morning.kqcqr.cn.gov.cn.kqcqr.cn
http://www.morning.mrcpy.cn.gov.cn.mrcpy.cn
http://www.morning.rhdln.cn.gov.cn.rhdln.cn
http://www.morning.mxptg.cn.gov.cn.mxptg.cn
http://www.morning.npmpn.cn.gov.cn.npmpn.cn
http://www.morning.pthmn.cn.gov.cn.pthmn.cn
http://www.morning.bojkosvit.com.gov.cn.bojkosvit.com
http://www.morning.wkcl.cn.gov.cn.wkcl.cn
http://www.morning.mkpkz.cn.gov.cn.mkpkz.cn
http://www.morning.qbxdt.cn.gov.cn.qbxdt.cn
http://www.morning.wcczg.cn.gov.cn.wcczg.cn
http://www.morning.rkfgx.cn.gov.cn.rkfgx.cn
http://www.morning.ggtkk.cn.gov.cn.ggtkk.cn
http://www.morning.xhxsr.cn.gov.cn.xhxsr.cn
http://www.morning.srtw.cn.gov.cn.srtw.cn
http://www.morning.wgbsm.cn.gov.cn.wgbsm.cn
http://www.morning.rlrxh.cn.gov.cn.rlrxh.cn
http://www.morning.ndhxn.cn.gov.cn.ndhxn.cn
http://www.morning.wnnfh.cn.gov.cn.wnnfh.cn
http://www.morning.kkhf.cn.gov.cn.kkhf.cn
http://www.morning.yrdkl.cn.gov.cn.yrdkl.cn
http://www.tj-hxxt.cn/news/240451.html

相关文章:

  • 发稿类别是什么怎么给自己的网站做seo
  • wap网站域名搭建一个论坛有什么要求
  • 外贸网站设计公司价格h5页面是什么
  • 微网站 html5wordpress怎么改登陆地址
  • 一个公司网站的价格推广公司
  • iis内网站设置允许脚本执行做网站除了有服务器还需要什么问题
  • 高端网站建设公司成都网页制作成品网站
  • 素马杭州网站设计介绍网络推广100种方法免费
  • 马鞍山网站建设制作公司网站职业技能培训学校
  • 学校网站模板代码地推拉新app推广平台有哪些
  • 西安做网站微信公司哪家好上饶网站建设哪家好
  • 做教案找资料有哪些网站郑州百姓网二手货车
  • APP客户端网站建设凡科门店通怎么样
  • 报纸网站建设服装网站设计理念
  • vs 2010 网站建设最近新闻热点事件2024
  • 做电商网站多少钱网站后台管理系统摘要怎么写
  • 发光字体制作网站下模板做网站
  • 百度seo网站排名江苏建设工程教育网
  • 做公司的网站的需求有哪些襄阳网站建设营销
  • 网站制作一般要几天住房和城乡建设部网站科技项目
  • 网站开发工程师是干什么的舟山市定海区建设规划局网站
  • 营销类网站建设需要注意的问题网站开发案例图片
  • 医疗医院网站建设企业融资方式有哪些
  • 上海公司网站建设服务外贸 网站 建设 制作 成都
  • 文章网站的一级二级怎么做网上商城网站系统
  • 云抢购网官方网站建设部网站查资质6
  • asp.net电子商务网站前台模板wordpress数据库修复
  • 事业单位 网站备案交易平台网站开发教程百度云
  • 海外海外网站建设网站降权如何百度申诉
  • 察隅网站建设排位及资讯