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

汉中微信网站建设开发百度运营公司

汉中微信网站建设开发,百度运营公司,班级网站 模板,网站建设的利弊kubernetes调度——污点Taint和容忍Toleration 一、通过节点属性调度1、节点名称2、节点标签2.1 查看节点标签2.2 添加标签2.3 修改标签2.4 删除标签2.5 通过节点标签进行调度 二、污点Taint和容忍Toleration1、污点Taint1.1 查看Master节点的污点1.2 添加污点1.3 删除污点 2、…

kubernetes调度——污点Taint和容忍Toleration

  • 一、通过节点属性调度
    • 1、节点名称
    • 2、节点标签
      • 2.1 查看节点标签
      • 2.2 添加标签
      • 2.3 修改标签
      • 2.4 删除标签
      • 2.5 通过节点标签进行调度
  • 二、污点Taint和容忍Toleration
    • 1、污点Taint
      • 1.1 查看Master节点的污点
      • 1.2 添加污点
      • 1.3 删除污点
    • 2、容忍Toleration

一、通过节点属性调度

1、节点名称

[root@k8s-master ~]# kubectl get nodes
NAME                   STATUS   ROLES           AGE    VERSION
k8s-master.linux.com   Ready    control-plane   127d   v1.29.1
k8s-node01.linux.com   Ready    <none>          127d   v1.29.1
k8s-node02.linux.com   Ready    <none>          127d   v1.29.1
apiVersion: apps/v1
kind: Deployment
metadata:name: test1
spec:replicas: 2selector:matchLabels:app: test1template:metadata:labels:app: test1spec:nodeName: k8s-node02.linux.com					// 指定工作节点名称containers:- name: test1image: centos:7imagePullPolicy: IfNotPresentcommand:- sleep- "3600"
[root@k8s-master schedulerTest]# kubectl create -f test1.yaml 
deployment.apps/test1 created
[root@k8s-master schedulerTest]# 
[root@k8s-master schedulerTest]# kubectl get pod -o wide
NAME                         READY   STATUS                   RESTARTS   AGE   IP              NODE                   NOMINATED NODE   READINESS GATES
test1-d69854cd5-jgpvm        1/1     Running                  0          7s    10.88.242.139   k8s-node02.linux.com   <none>           <none>
test1-d69854cd5-tzx6l        1/1     Running                  0          7s    10.88.242.138   k8s-node02.linux.com   <none>           <none>

2、节点标签

2.1 查看节点标签

[root@k8s-master schedulerTest]# kubectl get nodes --show-labels 
NAME                   STATUS   ROLES           AGE    VERSION   LABELS
k8s-master.linux.com   Ready    control-plane   127d   v1.29.1   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-master.linux.com,kubernetes.io/os=linux,node-role.kubernetes.io/control-plane=,node.kubernetes.io/exclude-from-external-load-balancers=
k8s-node01.linux.com   Ready    <none>          127d   v1.29.1   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-node01.linux.com,kubernetes.io/os=linux
k8s-node02.linux.com   Ready    <none>          127d   v1.29.1   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-node02.linux.com,kubernetes.io/os=linux

2.2 添加标签

[root@k8s-master schedulerTest]# kubectl label node k8s-node01.linux.com disk=ssd 
node/k8s-node01.linux.com labeled
[root@k8s-master schedulerTest]# kubectl get nodes --show-labels
NAME                   STATUS   ROLES           AGE    VERSION   LABELS
k8s-master.linux.com   Ready    control-plane   127d   v1.29.1   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-master.linux.com,kubernetes.io/os=linux,node-role.kubernetes.io/control-plane=,node.kubernetes.io/exclude-from-external-load-balancers=
k8s-node01.linux.com   Ready    <none>          127d   v1.29.1   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,disk=ssd,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-node01.linux.com,kubernetes.io/os=linux
k8s-node02.linux.com   Ready    <none>          127d   v1.29.1   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-node02.linux.com,kubernetes.io/os=linux

2.3 修改标签

[root@k8s-master schedulerTest]# kubectl label node k8s-node01.linux.com disk=full --overwrite 
node/k8s-node01.linux.com labeled
[root@k8s-master schedulerTest]# kubectl get node --show-labels
NAME                   STATUS   ROLES           AGE    VERSION   LABELS
k8s-master.linux.com   Ready    control-plane   127d   v1.29.1   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-master.linux.com,kubernetes.io/os=linux,node-role.kubernetes.io/control-plane=,node.kubernetes.io/exclude-from-external-load-balancers=
k8s-node01.linux.com   Ready    <none>          127d   v1.29.1   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,disk=full,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-node01.linux.com,kubernetes.io/os=linux
k8s-node02.linux.com   Ready    <none>          127d   v1.29.1   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-node02.linux.com,kubernetes.io/os=linux
[root@k8s-master schedulerTest]# 

2.4 删除标签

[root@k8s-master schedulerTest]# kubectl label node k8s-node01.linux.com disk-
node/k8s-node01.linux.com unlabeled

2.5 通过节点标签进行调度

apiVersion: apps/v1
kind: Deployment
metadata:name: test2
spec:replicas: 2selector:matchLabels:app: test2template:metadata:labels:app: test2spec:nodeSelector:								// 节点标签 ram: highercontainers:- name: test2image: centos:7imagePullPolicy: IfNotPresentcommand:- sleep- "3600"

二、污点Taint和容忍Toleration

污点、容忍配合使用,避免pod被分配不合适的机器

1、污点Taint

污点,本质上就是个key-value

1.1 查看Master节点的污点

[root@k8s-master schedulerTest]# kubectl describe node k8s-master.linux.com | grep -i taint
Taints:             node-role.kubernetes.io/control-plane:NoSchedule

1.2 添加污点

格式:# kubectl taint node <节点名称> key=value:{NoSchedule|NoExecute|PreferNoSchedule}

污点策略:

  • NoSchedule
    新建的POD不会再向该节点调度
    已经运行在该节点的POD不会受影响

  • NoExecute
    新建的POD不会再向该节点调度
    已经运行在该节点的POD同时也会被驱逐

  • PreferNoSchedule
    尽量不向该节点调度新建的POD

[root@k8s-master schedulerTest]# kubectl taint node k8s-node02.linux.com fan=error:NoExecute 
node/k8s-node02.linux.com tainted[root@k8s-master schedulerTest]# kubectl describe node k8s-node02.linux.com | grep -i taint
Taints:             fan=error:NoExecute

1.3 删除污点

格式:# kubectl taint node <节点名称> key:{NoSchedule|NoExecute|PreferNoSchedule}-

2、容忍Toleration

apiVersion: apps/v1
kind: Deployment
metadata:name: test5
spec:replicas: 2selector:matchLabels:app: test5template:metadata:labels:app: test5spec:containers:- name: test5image: centos:7imagePullPolicy: IfNotPresentcommand:- sleep- "3600"tolerations:									// 容忍fan=error这个污点- key: "fan"operator: "Equal"value: "error"effect: NoExecute
[root@k8s-master ~]# kubectl get pod -o wide
NAME                         READY   STATUS                   RESTARTS   AGE         IP              NODE                   NOMINATED NODE   READINESS GATES
test5-7575ffc867-hs9hf       1/1     Running                  0          2m1s        10.88.242.129   k8s-node02.linux.com   <none>           <none>
test5-7575ffc867-lp4k2       1/1     Running                  0          2m1s        10.88.201.193   k8s-node01.linux.com   <none>           <none>
http://www.yayakq.cn/news/183003/

相关文章:

  • 网站前置审批证书直播网站建设需要什么
  • 网站交互怎么做的陕西省住房和建设厅官网
  • 做网站会不会亏本周口市建设职工培训中心网站
  • 株洲做网站的公司文化建设的意义
  • 深圳网站建设 案例网站怎样做推广
  • 网站建设脚本西安公司网站开发
  • 做公司网站协议书模板下载网站带gov后缀
  • 邯郸网站建设哪家强做企业网站设计
  • 做旅游网站设计的感想wordpress的json api
  • 网站织梦后台一片白网上推广方法
  • 台州建设公司网站烟台建网站哪家好
  • 潍坊手机网站建e网app下载链接
  • 中国招标机构哪个网站做的好wordpress 页面插件
  • 网站架构设计师简历wordpress禁用emoji
  • 南昌p2p网站专业建设石家庄网站建设哪里好
  • 如何增加网站的访问量河南郑州最新事件
  • 泰州网站建设制作谷歌推广seo
  • 中国建设银行官网站电话号码网站开发 学习步骤
  • 网站建设常识网站建设技术知识大全茂名公司网站开发
  • 大型企业网站优化网页设计与制作实践
  • 岳麓区网站建设wordpress短链接清除
  • 东莞能做网站的公司手机论坛哪个最火
  • 建设网站主要有哪些技术在线咨询平台系统
  • 源码站校园网站模版
  • 网页微博打不开现在百度怎么优化排名
  • ppt免费模板下载网站有哪些网站修改了关键词被降权
  • 单位网站等级保护必须做吗橙色企业网站模板
  • 推推蛙网站建设logo设计生成器免费
  • 网站备案注销找哪个部门济南制作网站公司哪家好
  • 大眼睛网站建设seo技术培训泰州