k8s eviction机制

kubelete端:

创建eviction manager然后一直的去执行synchronize,synchronize函数会去计算node的是否超过阈值,没有则返回,过一段时间在计算,有超过则killpod.hardEvicthon则过一段时间再去

计算节点阈值情况:
// determine the set of resources under starvation
starvedResources := reclaimResources(thresholds)
if len(starvedResources) == 0 {
   glog.V(3).Infof("eviction manager: no resources are starved")
   return
}

soft的eviction是通过过滤graceperiod时间还是满足threshold,则进行evict

hard的监控到超过threshold则直接进行evict

综上:soft和hard的处理是通过threshold的GracePeriod成员,并设置其值,0表示hard,其他表示soft,并根据这个threshold来排序activepod,每次执行synchronize只删除一个pod.

猜你喜欢

转载自blog.csdn.net/wasd12121212/article/details/82780816