k8s那点事儿k8s入门到进阶k8s入门

K8S调度器 污点使用方法

2019-06-13  本文已影响2人  lyy910203
默认调度是:最大空闲资源调度

调度器

预算策略

CheckNodeCondition:检查节点网络磁盘等是否正常

GeneralPredicates:通用预选策略

HostName:检查pod对象是否定义了pod.spec.hostname

podFitsHostPorts: pods.spec.containers.ports.hostPort

MatchNNodeSelector:pods.spec.nodeSelector

PodFitsResources:检查Pod资源需求能否被节点满足

NoDiskConflict:检查pod依赖的存储卷能否满足,默认不启用

PodToleratesNodeTaints:检查Pod上的spec.tolerations客容忍五点是否包含节点污点

PodToleratesNodeBoExecteTaints:默认不启用

CheckNodeLabelPresence:检查节点标签存在,默认不启用

CheckServiceAffinity:根据当前pod所属pod所属对象services放在同一个node

污点调度

kubectl describe node node-name

官方文档:https://kubernetes.io/zh/docs/concepts/configuration/taint-and-toleration/

kubectl taint nodes node1 key=value:NoSchedule

kubectl taint nodes node1 key=value:NoExecute

kubectl taint nodes node1 key=value:PreferNoSchedule
kubectl taint nodes kube11 key:NoSchedule-
apiVersion: apps/v1Beta1
kind: Deployment
metadata:
  name: nginx-deploy
spec:
  replicas: 1
    selector:
      matchLabels:
        app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        images: nginx:laste
        ports:
        - containerPort: 80       
    tolerations:  #containers同级
    - key: "key1"          #能容忍的污点key
      operator: "Equal"    #Equal等于表示key=value , Exists不等于,表示当值不等于下面value正常
      value: "value1"      #值
      effect: "NoExecute"  #effect策略,见上面
      tolerationSeconds: 3600  #原始的pod多久驱逐,注意只有effect: "NoExecute"才能设置,不然报错

上一篇下一篇

猜你喜欢

热点阅读