2026/2/14 4:50:11
网站建设
项目流程
天津做企业网站公司,足球比赛直播360,做公益网站赚钱吗,上海aso背景#xff1a;
一个应用占用的资源很大#xff0c;而节点不是很大时#xff0c;需要让这个应用单独占据一个节点#xff0c;不让别的应用调度到这个节点上#xff0c;从而避免业务高峰时资源不够在node上设置污点kubectl taint nodes node-1 dedicatedadmin-server:NoSc…背景一个应用占用的资源很大而节点不是很大时需要让这个应用单独占据一个节点不让别的应用调度到这个节点上从而避免业务高峰时资源不够在node上设置污点kubectl taint nodes node-1 dedicatedadmin-server:NoSchedule其中dedicatedadmin-server是keyvalue自定义的NoSchedule是effect表示新的pod不能调度到这个节点上在pod上设置容忍spec: tolerations: - key: dedicated operator: Equal value: admin-server effect: NoSchedule这个tolerations跟node上的taint对应表示能够容忍这个污点在node打标签设置标签选择器上面两部只能让pod容忍这个node且node上不调度别的pod但是目标pod还是会调度到别的节点上所以需要nodeSelector来让pod固定到目标node上node上打标签kubectl label node node-1 selectoradmin-nodepod上设置标签选择器spec: nodeSelector: selector: admin-node这样这个pod就只能调度到这个node上了亲和度问题但是这样设置一旦目标node notready目标pod并会调度到别的节点上而是变成pending状态等待调度所以可以把标签选择器换成affinity亲和度spec: affinity: nodeAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 100 preference: matchExpressions: - key: selector operator: In values: - admin-node其中preferred 不是强制条件DuringScheduling 只在调度时生效IgnoredDuringExecution 运行期间不再管这样当node挂了时pod消失Deployment重现创建pod再根据affinity打分目标node为0分pod调度到别的节点