preferredDuringSchedulingIgnoredDuringExecution
is a soft constraint. Scheduler takes your preference into consideration but it need not honor it if some other node has higher priority score after running through other scheduler logic. You have also given it a weight: 1
which is the minimal weight.
If you want to enforce the pod to run on worker4
, you can create a hard constraint using requiredDuringSchedulingIgnoredDuringExecution
instead of preferredDuringSchedulingIgnoredDuringExecution
. This would mean if there is no other node matching the label kubernetes.io/hostname: worker4
, your pod would become unschedulable.
If you want to use preferredDuringSchedulingIgnoredDuringExecution
so that your pod can get scheduled to any node in event that worker4
is not available, you can try increasing the weight. weight takes a range range 1-100
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…