调度器、预选策略及优选函数

调度过程分为以下3个阶段

  • 预选--->优选---->选定

  • predicate--->priority--->select

 

污点标识,容忍污点,可配置是否容忍污点进行调度(Taints,Tolerations )

优选函数计算公式

(CPU((容量  -  POD请求拿走的容量))10/总容量)+内存((容量  -  POD请求拿走的容量))10/总容量))

  • 节点选择器:nodeSelector,nodeName

  • 节点亲和调度:nodeAffinity

 

 

节点选择器使用案例

apiVersion: v1                                                
kind: Pod
metadata:
  name: pod-demo
  namespace: default
  lables:
    app: frontend
spec:
  containers:
  - name: myapp
    image: ikubernetes/myapp:v1
    imagePullPolicy: IfNotPresent
  nodeSelector:
    disktype: ssd

节点亲和调度案例

apiVersion: v1                                                
kind: Pod
metadata:
  name: pod-demo
  namespace: default
  lables:
    app: frontend
spec:
  containers:
  - name: myapp
    image: ikubernetes/myapp:v1
    imagePullPolicy: IfNotPresent
  affinity:
    nodeAffinity:
      preferredDuringSchedulingIgnoredDuringExecution:
        nodeSelecorTerms:
        - matchExpressions:
          - key: zone
            operator: in
            values:
            - foo
            - bar
      weght: 60

ss