Answer the question
In order to leave comments, you need to log in
Why can kubernetes scheduler ignore nodeAffinity?
Hello.
There is a k8s cluster version 1.12 deployed on aws using kops
The cluster has a number of nodes marked with the 'example.com/wtf' label, which takes the values a, b, c, d
For an example, something like this
Node name example.com/wtf
instance1 a
instance2 b
instance3 c
instance4 d
apiVersion: apps/v1
kind: Deployment
metadata:
name: test-scheduler
spec:
replicas: 6
selector:
matchLabels:
app: test-scheduler
template:
metadata:
labels:
app: test-scheduler
spec:
tolerations:
- key: spot
operator: Exists
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- preference:
matchExpressions:
- key: example.com/wtf
operator: In
values:
- a
weight: 40
- preference:
matchExpressions:
- key: example.com/wtf
operator: In
values:
- b
weight: 35
- preference:
matchExpressions:
- key: example.com/wtf
operator: In
values:
- c
weight: 30
- preference:
matchExpressions:
- key: example.com/wtf
operator: In
values:
- d
weight: 25
containers:
- name: a
resources:
requests:
cpu: "100m"
memory: "50Mi"
limits:
cpu: "100m"
memory: "50Mi"
image: busybox
command:
- 'sleep'
- '99999'
NODE LABEL
wtf1 NONE
node1 a
node2 b
node3 c
wtf2 NONE
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question