当前位置: 首页 > 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/847269/

相关文章:

  • 注册网站多少钱佛山网站制作哪里实惠
  • 教育网站网址如何用ps制作网站
  • 大连企业制作网站产品宣传视频怎么制作
  • 网站推广和seo合肥 网站运营
  • 绍兴网站建设企业安全网站建设情况
  • 陕西城乡建设网站建立免费网站
  • 电子商务网站建设的心得体会wordpress setcookie
  • 太原网站排名外包wordpress get_the_date
  • 怎么申请自己的企业邮箱百度seo优化推广
  • 网站同时做竞价和优化可以吗广州网站建设网站托管运营
  • 河南郑州网站关键词排名助手wordpress的pdf阅读
  • 做旅游网站的要求想做网站
  • 简述网站开发设计流程如何做自助搜券网站
  • 创建网站的视频查询网站备案进度
  • 万能搜索引擎网站个人网页设计说明500字
  • 如果网站没有做icp备案吗站长工具seo综合
  • 服装网站建设费用wordpress程序伪静态
  • 怎么搭建源码网站萝岗网站建设优化
  • 网站建设软件dw1w粉丝接广告多少钱
  • 网站空间维护洛阳洛龙区网络营销公司
  • 做网站的详细教程在wordpress中图标
  • 商务网站模板下载附近广告公司
  • 现在pc网站的标准一般是做多大网页微信怎么登录
  • 福安市网站建设安徽网站建设网站运营
  • 农村电商网站建设分类贵阳网站建设电话
  • 宁波网站推广建站服务品牌策划方案
  • 上海网站制作策律师手机网站模板
  • 网站建设立项福田做网站福田网站建设福田建网站500
  • 淘宝网站建设类直通车软文营销文章案例
  • 网站怎么设置关键词武宣县住房和城乡建设局网站